Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 19th, 2004, 12:48 PM
Authorized User
 
Join Date: Oct 2004
Location: , NY, USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ealkurabi
Default i love C++

hmm i wonder its a newbie question but to define a variable like for example.

           #define "jfdklsajfds" USHORT
can i like make a USHORT2 or something?
like i can abbreviate howwver i want?
just a simple quesiton srry to bother just itching at my brain.

thank you

Reply With Quote
  #2 (permalink)  
Old November 19th, 2004, 05:20 PM
Authorized User
 
Join Date: Feb 2004
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The general form is

#define symbolic_constant value

Where symbolic_constant is any valid C or C++ identifier (alphanumeric, first char is alpha, underscore counts as alpha, etc.)

The preprocessor will substitute the value for the symbolic_constant before handing the program to the compiler.

#define jfdklsajfds USHORT

only makes sense if USHORT is known to the compiler by the time jfdklsajfds is used in the program. Then, anywhere you use jfdklsajfds, it is af you had used USHORT
Code:
jfdklsajfds x;
printf("sizeof(x) = %d\n", sizeof(x));
Regards,

Dave
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
New To Programming would love help! davejmorley Xcode 0 July 2nd, 2007 03:15 AM
Fashionable and attractive handbag,I love it ida80 General .NET 1 June 19th, 2006 02:37 AM



All times are GMT -4. The time now is 04:49 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.