From: peter on
Hi all,

I would like to ask if somebody could explain to me the meaning of
such a code:

#if system

#if comp

#if port

As long as I understand, with such a ifs I can differentiate between
windows and linux/unix, but that's all.

Thanks & regards
peter
From: Louis Krupp on
On 5/17/2010 3:04 AM, peter wrote:
> Hi all,
>
> I would like to ask if somebody could explain to me the meaning of
> such a code:
>
> #if system
>
> #if comp
>
> #if port
>
> As long as I understand, with such a ifs I can differentiate between
> windows and linux/unix, but that's all.

"#if ..." is a command understood by the C preprocessor, cpp, and
possibly other preprocessors.

A preprocessor is a program that reads your source file, executes
preprocessor commands and then hands the result off to your compiler.

"#if" is used for conditional compilation. "comp" and "port" and
"system" are macros, preprocessor variables that may or may not have
been set. If, for example, "comp" has been set to something other than
"0", then code between "#if comp" and "#endif" will be compiled. If
"comp" has not been set, or if it has been set to something the
preprocessor sees as having the logical value false, then code between
"#if comp" and "#endif" will not be compiled.

The preprocessor is not part of the Fortran standard, and there is no
guarantee that one is built in to your compiler. If one is built in, it
may have different syntax.

What compiler are you using?

Louis

From: peter on
On 17 Mai, 11:27, Louis Krupp <lkrupp_nos...(a)indra.com.invalid> wrote:
> On 5/17/2010 3:04 AM, peter wrote:
>
> > Hi all,
>
> > I would like to ask if somebody could explain to me the meaning of
> > such a code:
>
> > #if system
>
> > #if comp
>
> > #if port
>
> > As long as I understand, with such a ifs I can differentiate between
> > windows and linux/unix, but that's all.
>
> "#if ..." is a command understood by the C preprocessor, cpp, and
> possibly other preprocessors.
>
> A preprocessor is a program that reads your source file, executes
> preprocessor commands and then hands the result off to your compiler.
>
> "#if" is used for conditional compilation.  "comp" and "port" and
> "system" are macros, preprocessor variables that may or may not have
> been set.  If, for example, "comp" has been set to something other than
> "0", then code between "#if comp" and "#endif" will be compiled.  If
> "comp" has not been set, or if it has been set to something the
> preprocessor sees as having the logical value false, then code between
> "#if comp" and "#endif" will not be compiled.
>
> The preprocessor is not part of the Fortran standard, and there is no
> guarantee that one is built in to your compiler.  If one is built in, it
> may have different syntax.
>
> What compiler are you using?
>
> Louis

Intel Fortran Compiler 10.1.024
Compaq Fortran Compiler
From: Louis Krupp on
On 5/17/2010 3:40 AM, peter wrote:
> On 17 Mai, 11:27, Louis Krupp<lkrupp_nos...(a)indra.com.invalid> wrote:
>> On 5/17/2010 3:04 AM, peter wrote:
>>
>>> Hi all,
>>
>>> I would like to ask if somebody could explain to me the meaning of
>>> such a code:
>>
>>> #if system
>>
>>> #if comp
>>
>>> #if port
>>
>>> As long as I understand, with such a ifs I can differentiate between
>>> windows and linux/unix, but that's all.
>>
>> "#if ..." is a command understood by the C preprocessor, cpp, and
>> possibly other preprocessors.
>>
>> A preprocessor is a program that reads your source file, executes
>> preprocessor commands and then hands the result off to your compiler.
>>
>> "#if" is used for conditional compilation. "comp" and "port" and
>> "system" are macros, preprocessor variables that may or may not have
>> been set. If, for example, "comp" has been set to something other than
>> "0", then code between "#if comp" and "#endif" will be compiled. If
>> "comp" has not been set, or if it has been set to something the
>> preprocessor sees as having the logical value false, then code between
>> "#if comp" and "#endif" will not be compiled.
>>
>> The preprocessor is not part of the Fortran standard, and there is no
>> guarantee that one is built in to your compiler. If one is built in, it
>> may have different syntax.
>>
>> What compiler are you using?
>>
>> Louis
>
> Intel Fortran Compiler 10.1.024
> Compaq Fortran Compiler

What does your compiler documentation have to say about the preprocessor?

Louis

From: peter on
On 17 Mai, 11:50, Louis Krupp <lkrupp_nos...(a)indra.com.invalid> wrote:
> On 5/17/2010 3:40 AM, peter wrote:
>
>
>
>
>
> > On 17 Mai, 11:27, Louis Krupp<lkrupp_nos...(a)indra.com.invalid>  wrote:
> >> On 5/17/2010 3:04 AM, peter wrote:
>
> >>> Hi all,
>
> >>> I would like to ask if somebody could explain to me the meaning of
> >>> such a code:
>
> >>> #if system
>
> >>> #if comp
>
> >>> #if port
>
> >>> As long as I understand, with such a ifs I can differentiate between
> >>> windows and linux/unix, but that's all.
>
> >> "#if ..." is a command understood by the C preprocessor, cpp, and
> >> possibly other preprocessors.
>
> >> A preprocessor is a program that reads your source file, executes
> >> preprocessor commands and then hands the result off to your compiler.
>
> >> "#if" is used for conditional compilation.  "comp" and "port" and
> >> "system" are macros, preprocessor variables that may or may not have
> >> been set.  If, for example, "comp" has been set to something other than
> >> "0", then code between "#if comp" and "#endif" will be compiled.  If
> >> "comp" has not been set, or if it has been set to something the
> >> preprocessor sees as having the logical value false, then code between
> >> "#if comp" and "#endif" will not be compiled.
>
> >> The preprocessor is not part of the Fortran standard, and there is no
> >> guarantee that one is built in to your compiler.  If one is built in, it
> >> may have different syntax.
>
> >> What compiler are you using?
>
> >> Louis
>
> > Intel Fortran Compiler 10.1.024
> > Compaq Fortran Compiler
>
> What does your compiler documentation have to say about the preprocessor?
>
> Louis- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Ok, thanks for the tip. I slowly understand what's going on there...