Thread View: gnu.utils.bug
3 messages
3 total messages
Started by Gary Levin
Sun, 16 Oct 1988 02:11
prototyping trouble
Author: Gary Levin
Date: Sun, 16 Oct 1988 02:11
Date: Sun, 16 Oct 1988 02:11
16 lines
812 bytes
812 bytes
certain prototype definitions appear not to be accepted. why does it complain about yyy, but not xxx? seems that there is a curious bug in the prototyping code. ------ char * yyy(); extern char * yyy(char *, char); char * xxx(); extern char * xxx(int,int); ----- Until it is fixed, I can't make use of the prototype checking, because the standard includes don't have the prototype info. (yyy is the same as index).
Re: prototyping trouble
Author: Jonathan S. Shapiro
Date: Mon, 17 Oct 1988 16:45
Date: Mon, 17 Oct 1988 16:45
41 lines
1551 bytes
1551 bytes
In article <8810160211.AA07329@sun.mcs.clarkson.edu> gary@SUN.MCS.CLARKSON.EDU (Gary Levin) writes: >certain prototype definitions appear not to be accepted. > >why does it complain about yyy, but not xxx? seems that there is a >curious bug in the prototyping code. > >------ >char * yyy(); >extern char * yyy(char *, char); > >char * xxx(); >extern char * xxx(int,int); >----- > >Until it is fixed, I can't make use of the prototype checking, because >the standard includes don't have the prototype info. (yyy is the same >as index). It better not be fixed! It is right! The reason is this: When the compiler sees char *yyy() It assumes that all args get passed as 32 bit quantities. Once it actually knows that the size of a char is 8 bits, it is free to (consistently) pass that as an 8 bit or 16 bit quantity if the architecture allows. char *xxx(int, int) on the other hand, doesn't in any way affect arg passing on a 32 bit int machine. Therefore, char *yyy(char *, char) need not have the same stack layout as char *yyy() Jon
Re: prototyping trouble
Author: Gary Levin
Date: Fri, 21 Oct 1988 18:32
Date: Fri, 21 Oct 1988 18:32
16 lines
1320 bytes
1320 bytes
Thanks to those who pointed out the relation between the old and new definitions and the old and new function heads. The ANSI standard could have been written more clearly. Warning: Borland's interpretation of the ANSI standard is off. Their view is that the prototyped definitions (i.e. prototype without the body) would control the widening effect of BOTH the call and the function head. This is convenient, but, as you have shown, wrong. My apologies for posting to the util group by mistake. Thought I'd send the thanks here, but further comments should move to gcc.bug -- ----- Gary Levin/Dept of Math & CS/Clarkson Univ/Potsdam, NY 13676/(315) 268-2384 BitNet: gary@clutx Internet: gary@clutx.clarkson.edu
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads