C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How Many Characters Can Be used With #define Posted by RIGHT_THEN on 7 Apr 2007 at 12:29 AM
GentleMen,
In C 31 is the upper limit for Defining the Variable names
Beyond which one cannot be sure for the uniqness of the variablenames

I have searched a lot and have not found as to what is the
upper limit for defining names with #define
For Instance
#define Vanilla_IceCreame 0

now where ever i have to use 0 i can use Vanilla_IceCreame

I want to know How Far Can I streatch This Can I write A Full Essay!!!!

#deinfe My_Best_friend_He_Lives_in..........and it continues 




Report
Re: How Many Characters Can Be used With #define Posted by AsmGuru62 on 7 Apr 2007 at 4:52 AM
: GentleMen,
: In C 31 is the upper limit for Defining the Variable names
: Beyond which one cannot be sure for the uniqness of the variablenames
:
: I have searched a lot and have not found as to what is the
: upper limit for defining names with #define
: For Instance
:
: #define Vanilla_IceCreame 0
: 
: now where ever i have to use 0 i can use Vanilla_IceCreame
: 
: I want to know How Far Can I streatch This Can I write A Full Essay!!!!
: 
: #deinfe My_Best_friend_He_Lives_in..........and it continues 
: 
: 

:
:
:
I am not sure about the limit itself, but it should be easy to check using TC 31 itself. Just keep trying longer and longer names and see when compiler will start giving messages.

Report
Re: How Many Characters Can Be used With #define Posted by stober on 12 Apr 2007 at 7:37 PM
: : GentleMen,
: : In C 31 is the upper limit for Defining the Variable names
: : Beyond which one cannot be sure for the uniqness of the variablenames
: :
: : I have searched a lot and have not found as to what is the
: : upper limit for defining names with #define
: : For Instance
: :
: : #define Vanilla_IceCreame 0
: : 
: : now where ever i have to use 0 i can use Vanilla_IceCreame
: : 
: : I want to know How Far Can I streatch This Can I write A Full Essay!!!!
: : 
: : #deinfe My_Best_friend_He_Lives_in..........and it continues 
: : 
: : 

: :
: :
: :
: I am not sure about the limit itself, but it should be easy to check using TC 31 itself. Just keep trying longer and longer names and see when compiler will start giving messages.
:

:


depends on the compiler. Current Microsoft compilers has a limit of 2,047 characters.

http://msdn2.microsoft.com/en-us/library/bc2y4ddf(VS.80).aspx
Report
Re: How Many Characters Can Be used With #define Posted by shrinivasrathi on 20 Apr 2007 at 3:54 AM
Read ANSI C standard doc. Probably u wil find answer there.
-------------------------------------------------
Ask questions , send your answers, share your views, write anything about C programming @ http://cprogramming4u.blogspot.com/

Report
Why ?! Posted by Mohammad Rast on 23 Apr 2007 at 1:06 AM
Hi,
Why do you want so long definitions ?
Even for defining a macro with #define, it'll be used for small macros.
--------------------------------------
- I don't have Time To waste The Time!




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.