www.delorie.com/djgpp/bugs/show.cgi | search |
#ifdef __DJGPP__ /* What's this. where is this external float/integer/character/whatever variable 'index' Built into the compiler, 3:42 PM 03/01/2000 a2k@engineer.com DJGPP Version 2.02 dj@delorie.com http://www.delorie.com/djgpp/ */ int main ( void ) { extern float index; //Whatever you like uncomment // extern int index; // extern char index; return ++index; } #endif
`index' is not a variable, it's a function. You could do the same with `sin' or `abort' or any other library function. It's a perfectly valid operation to increment "++index": it means you increment a pointer to that function. This is not a bug. I'm closing this report.
Just to avoid some potential confusion: 'index' is a traditional UNIX library call, equivalent to 'strchr()'. The example program is incorrect in itself, from the point of view of Standard C, so it cannot be used to show a bug in the compiler or library: It uses a variable declared as 'external', but doesn't link in any other file that defines it, even though 'index' is not defined by Standard C. Anyway, I wonder how anyone could have missed the first thing to try, in such a case: look up in the docs if anything called 'index' is defined in the library: info libc alphabetic index et voila: there you see that it exists, and what it is.
webmaster | delorie software privacy |
Copyright © 2010 by DJ Delorie | Updated Jul 2010 |