LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   difference between gcc 3.4.1 and 4.2.0 (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/difference-between-gcc-3-4-1-and-4-2-0-a-875966/)

dimaloma 04-19-2011 03:27 PM

difference between gcc 3.4.1 and 4.2.0
 
My apologies if this is the wrong forum for my question
We recently switched from arm cross compiler g++ v3.4.1 to v4.2.0.
One of our structures had variable "index", and constructor had something like this: foo(): index(0){}
This compiled without problems with g++ v3.4.1
The new compiler complains that this macro takes two parameters. In fact, I found such line in standard strings.h:
#define index(s,c) strchr((s), (c))
So, I think the new compiler tries to call strchr() here instead of member variable initialization.
Does anybody know what old compiler did in this case? If it called strchr(), what did it use as a second parameter? Can this be the reason of stack corruption that we had with the code compiled with the old compiler?
If the old one properly initialized variable index, what was the reason for the new one to change its behavior?
Thanks a lot

John VV 04-20-2011 02:48 AM

to many to post
Please READ the gcc web site
http://gcc.gnu.org/
example
the porting page for 4.1 to 4.3
http://gcc.gnu.org/gcc-4.3/porting_to.html

dimaloma 04-20-2011 06:07 PM

Quote:

Originally Posted by John VV (Post 4330247)
to many to post
Please READ the gcc web site
http://gcc.gnu.org/
example
the porting page for 4.1 to 4.3
http://gcc.gnu.org/gcc-4.3/porting_to.html

I failed to find anything related to the relationship between macro and class member initialization for various GCC versions in this link.I still do not know whether old preprocessor applied macro to member init or not. Thanks, anyway.


All times are GMT -5. The time now is 10:38 PM.