Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » are ULONG and WCHAR c or c++ programming keywords?
Closed Thread
Old 12-20-2006, 01:01 PM   #1 (permalink)
 
Master Techie

Join Date: Mar 2004

Posts: 2,069

rookie1010

Default are ULONG and WCHAR c or c++ programming keywords?

Hello

are ULONG and WCHAR c or c++ programming keywords
rookie1010 is offline  
Old 12-20-2006, 02:20 PM   #2 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default

No, they are not keywords.
jaeusm is offline  
Old 12-20-2006, 02:30 PM   #3 (permalink)
 
Newb Techie

Join Date: Dec 2006

Posts: 10

Review Tech

Default

I don't believe they are.
Review Tech is offline  
Old 12-20-2006, 04:40 PM   #4 (permalink)
 
Master Techie

Join Date: Mar 2004

Posts: 2,069

rookie1010

Default

thanks for the reply,

would they need to be #defined in a header file?
rookie1010 is offline  
Old 12-20-2006, 08:37 PM   #5 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

Yes, they could either be defined in a header file or in the specific file you are editing. What you're doing is declaring a Macro.

#define MACRO VALUE

Example
Code:
#define ULONG 256
#define MAX 512
#define EMAIL "bla@bla.com"
All this does is tells the linker to replace any instances of ULONG, MAX and EMAIL anywhere in the code with their respective values.
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 12-25-2006, 08:12 AM   #6 (permalink)
 
Master Techie

Join Date: Mar 2004

Posts: 2,069

rookie1010

Default

thanks for the reply

so what one would do is define macros depending upon the architecture.
rookie1010 is offline  
Old 12-25-2006, 01:10 PM   #7 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

That's one thing they are used for. I personally use them so the code is easily modified. Say I'm reading lots of input, and I only want my program to use up so much memory. I use the following code

Code:
#define MAXLEN 512

char line1[MAXLEN];
char line2[MAXLEN];
char line3[MAXLEN];
I realize later that only having buffers of length 512 isn't enough, so I want to change them to 1024. By defining the macro MAXLEN all I need to change is the value at the top, not all of them throughout the program. I believe you can use macros to help make your programs more architecture independent using #ifndef and then check what platform you are running on (this would be at complie time, not runtime).

Macros can do different things depending on the language you're writing in. I'm moslty familiar with C, so that's what my example is in. I belive you can do a lot more "nifty" things with them in more advanced languages.
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 12-25-2006, 07:44 PM   #8 (permalink)
 
Master Techie

Join Date: Mar 2004

Posts: 2,069

rookie1010

Default

thanks for the reply dude
rookie1010 is offline  
 
Closed Thread

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