home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!gatech!destroyer!ais.org!draper
- From: draper@ais.org (Patrick Draper)
- Subject: Is this ANSI?
- Message-ID: <BzqnK1.8t6@ais.org>
- Organization: UMCC
- Date: Thu, 24 Dec 1992 00:47:58 GMT
- Lines: 39
-
- I was playing with the Turbo C++ 1.01 compiler, and I found that it choked
- on this code:
-
- void foo (struct bar *x);
-
- struct bar {
- int aaa;
- int bbb;
- };
-
- void foo (struct bar *x)
- {
-
- ....
-
- }
-
- It complained about the redeclaration of function foo. If I put the
- structure definition before the prototype, Turbo C++ 1.01 is happy.
-
- This code works just fine with the borland C++ 2.0 and Borland C++ 3.1
- compilers, and that leads me to suspect that the Turbo C++ 1.01 is not
- strictly ANSI in this regard.
-
- My question is: what does ANSI say about this. Stylistically, I can see that
- it is preferable to define the structure before I use it, however, it is
- defined in the global realm, thus should be visible.
-
- Is this an artifact of a one pass vs. two pass compiler? (I don't know if
- Turbo C++ 1.01 is one pass or not)
-
- Thanks,
-
- ------------------////////////////////\\\\\\\\\\\\\\\\\\\\------------------
- | Patrick Draper-ZBT Disclaimer: I can't control my fingers, |
- | draper@umcc.ais.org I can't control my toes! - Ramones |
- | University of Michigan Computer Club |
- NO CARRIER We are a nation of laws, not people |
- ------------------\\\\\\\\\\\\\\\\\\\\////////////////////------------------
-