473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

GCC Preprocessor

Is there any way I can check to see what agriculture (x86_64, ppc,
ia32, etc) I am compiling with using the preprocessor? All help is
appreciated.

May 10 '06 #1
8 2863
s7******@gmail.com wrote:
# Is there any way I can check to see what agriculture (x86_64, ppc,
# ia32, etc) I am compiling with using the preprocessor? All help is
# appreciated.

There may be system specific #defines which can identify the hardware
and/or software. You can then do things like
#ifdef __APPLE__
#if OSX_VERSION>4
..
#endif
#endif
Such defines are going to be system specific and should be documented
by the system integrator, manufacturer, etc.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I think that's kinda of personal; I don't think I should answer that.
May 10 '06 #2
s7******@gmail.com said:
Is there any way I can check to see what agriculture (x86_64, ppc,
ia32, etc) I am compiling with using the preprocessor? All help is
appreciated.


SM Ryan has already given you a reply that should field most of your
questions, but never forget you can grow your own preprocessor directives
in the event that your implementation doesn't identify itself so
conveniently. Keep them well-watered, and don't chaff at the extra workload
involved - it's amaizing just how often such a simple solution can work
really well.

Another way to deal with this problem is to crop it out completely and write
the code in a hardy perennial style, so that it doesn't matter what kind of
soil you use - the code can grow anywhere, and doesn't need any
preprocessor directives at all. In my experience, about 95% of the code can
be written that way (or even 100% in many cases), with the rest being
carefully isolated to avoid cross-pollination.

Apologies in advance (to careful readers only) for the corny reply.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
May 10 '06 #3
Richard Heathfield <in*****@invalid.invalid> writes:
s7******@gmail.com said:
Is there any way I can check to see what agriculture (x86_64, ppc,
ia32, etc) I am compiling with using the preprocessor? All help is
appreciated.

SM Ryan has already given you a reply that should field most of your
questions, but never forget you can grow your own preprocessor directives
in the event that your implementation doesn't identify itself so
conveniently. Keep them well-watered, and don't chaff at the extra workload
involved - it's amaizing just how often such a simple solution can work
really well. Another way to deal with this problem is to crop it out completely and write
the code in a hardy perennial style, so that it doesn't matter what kind of
soil you use - the code can grow anywhere, and doesn't need any
preprocessor directives at all. In my experience, about 95% of the code can
be written that way (or even 100% in many cases), with the rest being
carefully isolated to avoid cross-pollination. Apologies in advance (to careful readers only) for the corny reply.


In advance, or was the apology just for the 'corny' bit?
Or, is this a new version of bottom-posting?

--
Chris.
May 10 '06 #4
Chris McDonald said:
Richard Heathfield <in*****@invalid.invalid> writes:
Apologies in advance (to careful readers only) for the corny reply.


In advance, or was the apology just for the 'corny' bit?


In advance of smart-alec replies like yours. :-)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
May 10 '06 #5
s7******@gmail.com wrote:
Is there any way I can check to see what agriculture (x86_64, ppc,
ia32, etc) I am compiling with using the preprocessor? All help is
appreciated.

Nothing in general; but see http://predef.sourceforge.net/ for an overview
of what major compilers define.

--
Stan Tobias
mailx `echo si***@FamOuS.BedBuG.pAlS.INVALID | sed s/[[:upper:]]//g`
May 10 '06 #6
Richard Heathfield <in*****@invalid.invalid> writes:
Chris McDonald said:
Richard Heathfield <in*****@invalid.invalid> writes:
Apologies in advance (to careful readers only) for the corny reply.


In advance, or was the apology just for the 'corny' bit?

In advance of smart-alec replies like yours. :-)


Thanks, but as we've not met, no need to apologize for me ;-)

--
Chris.
May 10 '06 #7
Thanks for the advice, I looked more into the gcc preprocessor and
found what I was looking for at
http://www.network-theory.co.uk/docs...cintro_34.html . 'cpp
-dM /dev/null ' was what really helped me out. Also, the macro I was
looking for is __x86_64. I bought a 64 bit processor and felt like
taking advantage of it, that's why I need to know what agriculture,
although you are right that is is not necessary. Anyways, thanks again
for the help.

May 10 '06 #8
"Taylor K." <s7******@gmail.com> writes:
Thanks for the advice, I looked more into the gcc preprocessor and
found what I was looking for at
http://www.network-theory.co.uk/docs...cintro_34.html . 'cpp
-dM /dev/null ' was what really helped me out. Also, the macro I was
looking for is __x86_64. I bought a 64 bit processor and felt like
taking advantage of it, that's why I need to know what agriculture,
although you are right that is is not necessary. Anyways, thanks again
for the help.


The word you're looking for is "architecture", not "agriculture".
(Consult a dictionary for more information.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
May 10 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
24
by: Nudge | last post by:
I have an array, and an unrolled loop which looks like this: do_something(A); do_something(A); .... do_something(A); I thought: why should I type so much? I should write a macro. So I was...
16
by: Trying_Harder | last post by:
Is it possible to redefine a macro with global scope after undefining it in a function? If yes, could someone explain how? /If/ my question above isn't very clear you can refer to the...
13
by: seemanta dutta | last post by:
Greetings C gurus, I have used preprocessor directives since a very long time. But whenever I see some professional piece of C code, the linux kernel for example, I get literally confused by the...
18
by: /* frank */ | last post by:
My teacher said that array in C is managed by preprocessor. Preprocesser replace all array occurences (i.e. int a ) with something that I don't understand/remember well. What's exactly happens...
13
by: Chris Croughton | last post by:
Is the following code standard-compliant, and if so what should it do? And where in the standard defines the behaviour? #include <stdio.h> #define DEF defined XXX int main(void) { int...
9
by: Walter Roberson | last post by:
I have run into a peculiarity with SGI's C compiler (7.3.1.2m). I have been reading carefully over the ANSI X3.159-1989 specification, but I cannot seem to find a justification for the behaviour....
2
by: Paolo | last post by:
I imported a VC++6.0 project into VC++7.1. The conversion operation makes a mess with Preprocessor Definitions, adding a "$(NoInherit)" for each file. For example: I had a DLL project in VC++6.0...
32
by: spibou | last post by:
Is the output of the C preprocessor deterministic ? What I mean by that is , given 2 compilers which conform to the same standard, will their preprocessors produce identical output given as input...
31
by: Sam of California | last post by:
Is it accurate to say that "the preprocessor is just a pass in the parsing of the source file"? I responded to that comment by saying that the preprocessor is not just a pass. It processes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.