Sponsored Content
Full Discussion: constants in C/C++
Top Forums Programming constants in C/C++ Post 26780 by Shobhit on Friday 23rd of August 2002 09:23:32 AM
Old 08-23-2002
I agree that compilers are free to optimise the way they like.But i was surprised to see exactly similar behaviour for c and c++ respectively on VC++ ,Turbo,gnu,aCC compilers.
All changed value of constant in C compilation but the value remained same in C++ compilation.

similarly for array index being declared with constant.

Why all the vendors opted for such behaviour made me suspect if their is some standard.

shobhit
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl: eval and constants

is it possible to use eval to create constants in perl? i cannot seem to get anything to work, and my searches are turning up little to nothing. an example of what i am trying to do is this: 2 arrays: array 1: 'FOOD','NUMBER','OS' array 2: 'pizza','two','unix' loop through the arrays and... (5 Replies)
Discussion started by: effigy
5 Replies

2. Programming

char constants vs. hard-coding

This might be a silly question, but I thought I'd ask anyway. If I'm writing in C, isn't it more efficient to, for instance, use constant character variable set to 'A' instead of hard-coding a character 'A'? Since it's only a single character instead of a string, it might not matter much. (10 Replies)
Discussion started by: cleopard
10 Replies

3. UNIX for Dummies Questions & Answers

Operation with real variables and constants

Hello there, I'd like to define a variable b equal to 0.5/a where a=0.001, so I wrote something like that: a=0.001; let 'b=0.5/$a'; but it doesn't work... maybe because the variable a has a real value??? Any help will be appreciated!!!:D (1 Reply)
Discussion started by: Giordano Bruno
1 Replies
All times are GMT -4. The time now is 04:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy