RE: [Dev-C++] #DEFINE versus cont variables in array inicializations
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@te...> - 2003-05-30 03:36:08
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Per Westermark > Sent: Friday, May 30, 2003 4:23 AM > To: Ioannis Vranos > Cc: Dev-C++ Mailing List > Subject: RE: [Dev-C++] #DEFINE versus cont variables in array > inicializations > > > Yes, we agree that 'const int x = <value>' is efficient. > We don't agree that 'const int &x = <value>' is efficient. The reference can't be used to provide the size of a built in array, so my mistake for that. On the other hand regarding reference, a compiler would be able to optimise out and make it occupy no more space. const int &x=7; Can you tell me why that wouldn't be able to be equivalent to #define x 7 when used just as a value and not accessed in any other way? As I can think of it, a const reference should be more eaiser to optimise out than a const variable. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |