eric@nosun.west.sun.com (Eric Hanchrow) (02/27/90)
Here's an entire program which compiles just fine with gcc-1.37 (Sparc, SunOS 4.0.c). extern int fred(int a, int ); I tried compiling the same program with Microsoft C 5.1, and it said unto me, quote, junk3.c(1) : error C2059: syntax error : ',' I promptly got on the phone to Microsoft to chew them out about this obvious ANSI non-compatibility. The fella on the phone said, "No, the ANSI standard requires that you either name all the arguments in a function prototype, or none of them". Therefore, he claimed, the error generaed by Microsoft was correct (although not very informative). Now, I don't have a copy of the Standard, but if the guy at Microsoft was right, then gcc should also complain when presented with this code. For comparison, these programs (according to the guy from Microsoft) are correct: extern int fred(int a, int b); /* Both arguments are given names */ extern int fred(int , int ); /* Neither argument has a name */ Where does one get a copy of the Standard, anyway? Thanks!! ------------------------------------------------------------------------- |Eric Hanchrow yamada-sun!eric@nosun.west.sun.com | |Phase III Logic, Inc. ...!{tektronix, sun}!nosun!yamada-sun!eric | |1600 N.W. 167th Place Beaverton, OR 97006 | |Voice: (503)-645-0313 Fax: (503)-645-0207 as of 13-Dec-89 | -------------------------------------------------------------------------
eric@nosun.west.sun.com (Eric Hanchrow) (02/27/90)
The last message I mailed, whose subject was `function prototype syntax', had an error in it. It claimed that the version of gcc I was using was 1.37; in fact I was using version 1.36. ------------------------------------------------------------------------- |Eric Hanchrow yamada-sun!eric@nosun.west.sun.com | |Phase III Logic, Inc. ...!{tektronix, sun}!nosun!yamada-sun!eric | |1600 N.W. 167th Place Beaverton, OR 97006 | |Voice: (503)-645-0313 Fax: (503)-645-0207 as of 13-Dec-89 | -------------------------------------------------------------------------
sef@kithrup.com (Sean Eric Fagan) (02/27/90)
>I tried compiling the same program with Microsoft C 5.1, and it said >unto me, quote, > junk3.c(1) : error C2059: syntax error : ',' >I promptly got on the phone to Microsoft to chew them out about this >obvious ANSI non-compatibility. The fella on the phone said, "No, the >ANSI standard requires that you either name all the arguments in a >function prototype, or none of them". Therefore, he claimed, the >error generaed by Microsoft was correct (although not very >informative). uSoft is pulling your leg, and it's something they will be having problems with. At one point, I believe that the standard did require either all unnamed, or all named; now, it can be mixed. uSoft has not updated their compiler for this. People using SCO's Compiler have the same problem, of course, but it will be fixed shortly (I have it on good authority from the person who does the compiler work [me 8-)] that it is fixed, along with some other ANSI-isms). Sorry for the plug, of course, but this was largely informational. Sean.
rfg@ics.uci.edu (Ronald Guilmette) (02/28/90)
In article <9002270016.AA02978@yamada-sun.UUCP> yamada-sun!eric@nosun.west.sun.com (Eric Hanchrow) writes: > >Here's an entire program which compiles just fine with gcc-1.37 >(Sparc, SunOS 4.0.c). > extern int fred(int a, int ); >I tried compiling the same program with Microsoft C 5.1, and it said >unto me, quote, > junk3.c(1) : error C2059: syntax error : ',' >I promptly got on the phone to Microsoft to chew them out about this >obvious ANSI non-compatibility. The fella on the phone said, "No, the >ANSI standard requires that you either name all the arguments in a >function prototype, or none of them". Therefore, he claimed, the >error generaed by Microsoft was correct (although not very >informative). > >Now, I don't have a copy of the Standard, but if the guy at Microsoft >was right, then gcc should also complain when presented with this >code. I think that GCC is correct and that Microsoft is wrong. I'm looking at section 3.5.4.3 of the draft standard and I see no such restriction stated there. If there was such a restriction, it would belong in 3.5.4.3. You had better call back that guy at Microsoft and insist that he cite chapter and verse from the standard to back up his assertion. I am cross posting this to comp.std.c where some *real* C standard guru's may be willing to comment. // Ron Guilmette (rfg@ics.uci.edu) // C++ Entomologist // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.
henry@utzoo.uucp (Henry Spencer) (03/01/90)
In article <25EB0435.3408@paris.ics.uci.edu> rfg@ics.uci.edu (Ronald Guilmette) writes: >In article <9002270016.AA02978@yamada-sun.UUCP> yamada-sun!eric@nosun.west.sun.com (Eric Hanchrow) writes: >>I promptly got on the phone to Microsoft to chew them out about this >>obvious ANSI non-compatibility. The fella on the phone said, "No, the >>ANSI standard requires that you either name all the arguments in a >>function prototype, or none of them"... > >You had better call back that guy at Microsoft and insist that he cite >chapter and verse from the standard to back up his assertion. I see nothing in ANSI C (Oct 88 draft) that would support such an assertion. Unless I've missed something subtle, in a function declaration (as opposed to a definition), the names are optional on a parameter-by-parameter basis. Given that Microsoft -- as well as everybody else -- has been claiming "ANSI C compatibility" based on drafts rather than a final standard, it's possible that he and/or Microslop as a whole may have gotten this idea from an earlier draft and missed the liberalization of the rules. I don't remember the history of function declarations very well, but there may have been such a restriction at one point. -- "The N in NFS stands for Not, | Henry Spencer at U of Toronto Zoology or Need, or perhaps Nightmare"| uunet!attcan!utzoo!henry henry@zoo.toronto.edu