LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2010, 02:20 PM   #1
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;GO MAGEIA!!!Hopefully last destination is Gentoo
Posts: 903

Rep: Reputation: 52
C Language Question "Thing" that changes aliases for source code?




I can't seem to find or remember what the "thing" before the main program is called that changes all of the constants to an actual piece of data. Like instead of writing the actual number I want in code I type in what basically is an easy to remember variable name like "total". The preprocessor changes this name to the value and it is inserted directly to source code. What is this part of the compiler/preprocessor called?

Thanks in advance
 
Old 05-29-2010, 02:26 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by theKbStockpiler View Post


I can't seem to find or remember what the "thing" before the main program is called that changes all of the constants to an actual piece of data. Like instead of writing the actual number I want in code I type in what basically is an easy to remember variable name like "total". The preprocessor changes this name to the value and it is inserted directly to source code. What is this part of the compiler/preprocessor called?

Thanks in advance
No, the "thing" is not called before the main program. The "thing" is called before actual compiler is called and it is called "C" preprocessor".
 
1 members found this post helpful.
Old 05-29-2010, 02:29 PM   #3
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;GO MAGEIA!!!Hopefully last destination is Gentoo
Posts: 903

Original Poster
Rep: Reputation: 52
How do you invoke it?

Quote:
Originally Posted by Sergei Steshenko View Post
No, the "thing" is not called before the main program. The "thing" is called before actual compiler is called and it is called "C" preprocessor".

What is the reserved symbol that is used to invoke it?


It' not " # sum = 15 " but what is it?
 
Old 05-29-2010, 02:33 PM   #4
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
Quote:
Originally Posted by theKbStockpiler View Post
I can't seem to find or remember what the "thing" before the main program is called that changes all of the constants to an actual piece of data. Like instead of writing the actual number I want in code I type in what basically is an easy to remember variable name like "total". The preprocessor changes this name to the value and it is inserted directly to source code. What is this part of the compiler/preprocessor called?
It's like in the jeopardy game :-)

Code:
What is a macro?
I guess you mean the stuff like for example:

Code:
#define CONSTANT_VALUE 12
Alternatively, you could use enums to define a set of constants!

Andi
 
1 members found this post helpful.
Old 05-29-2010, 02:45 PM   #5
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;GO MAGEIA!!!Hopefully last destination is Gentoo
Posts: 903

Original Poster
Rep: Reputation: 52
Thanks again.

Quote:
Originally Posted by ForzaItalia2006 View Post
It's like in the jeopardy game :-)

Code:
What is a macro?
I guess you mean the stuff like for example:

Code:
#define CONSTANT_VALUE 12
Alternatively, you could use enums to define a set of constants!

Andi
Serendipity to you
 
Old 05-29-2010, 03:11 PM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
And another possibility is to use 'const' qualifier.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
looking for "C language algorithms for digital signal processing" source code jf.argentino Programming 14 03-05-2018 11:30 PM
How to get the "data type" of an "unknown variable" in "C Language" ? Affair Programming 8 06-20-2009 12:30 PM
Do i need "RPM Packages" or "SuSe Source code packages" Donati Linux - Software 3 03-19-2009 07:32 PM
How to convert Assembly code to "C" source code ssg14j Programming 2 08-01-2005 12:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration