This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug on sizeof(void) == 1, must be undefined or negative, == -100000.



On Jun 17, 2005, at 4:33 PM, jc-nospam@jr-pizarro.jazztel.es wrote:


Please, to run this script of 5 lines:

#!/bin/sh
cat > bug_void.c <<EOF
int main() { printf("sizeof(void) = %d\n",sizeof(void)); return 0; }

This is invalid code and a GNU extension to take the sizeof(void). The reason
why GCC defines it as 1 is because you can do the following:
void *a;
a++;


If you want to error out on GNU extensions, use -pedantic-errors.

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]