Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 04-19-2011, 04:27 PM   #1
LQ Newbie
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
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
Old 04-20-2011, 03:48 AM   #2
John VV
LQ Muse
Registered: Aug 2005
Posts: 15,906

Rep: Reputation: Disabled
to many to post
Please READ the gcc web site
the porting page for 4.1 to 4.3
Old 04-20-2011, 07:07 PM   #3
LQ Newbie
Registered: Apr 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Originally Posted by John VV View Post
to many to post
Please READ the gcc web site
the porting page for 4.1 to 4.3
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the difference between gcc and g++ bskumar7080 Linux - Newbie 2 08-10-2009 09:20 AM
Small difference when compiled with gcc and g++ drigz Programming 5 06-15-2006 05:09 PM
any difference between gcc-c++ and gcc-g++ RajRed Linux - Software 5 12-03-2005 12:37 PM
what is the difference b/w these two? (gcc related) tuxfood Programming 1 07-20-2004 10:48 AM
what IS the difference between g++ and gcc? acid_kewpie Programming 5 12-08-2001 07:11 AM

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration