RE: [Dev-C++] #DEFINE versus cont variables in array inicializations
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2003-05-29 22:03:00
|
I was also talking about c++, so obviously the extension of the source file (I normally use *.cc) tells gcc to use g++ for c++ compilation. /Per W On Thu, 29 May 2003, Ioannis Vranos wrote: > > -----Original Message----- > > From: Per Westermark [mailto:pw...@ia...] > > Sent: Friday, May 30, 2003 2:00 AM > > To: Ioannis Vranos > > Cc: Dev-C++ Mailing List > > Subject: RE: [Dev-C++] #DEFINE versus cont variables in array > > inicializations > > > > > > I guess you don't think of gcc as a decent compiler then. > > > > try gcc -O3 -S on the code below and look at the output. > > 4 byte for the value 7 > > 4 byte for the SIZE reference. > > access loads SIZE and pushes [SIZE] (4 byte addr info + extra instr) > > > > with const int SIZE = 7 > > zero byte for value > > every access pushes 7 directly. (4 byte value) > > > > Most compilers treat 'const int v = <value>' identical to #define XX > > <value>, i.e. optimal code is generated. > > > > ... and we are talking about C++ here, so g++ is the compiler and not gcc. > > > > Ioannis Vranos > > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL 1: http://run.to/noicys > * Alternative URL 2: http://www.noicys.cjb.net > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: eBay > Get office equipment for less on eBay! > http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |