lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] what is "defined() " ???


From: Piero 74
Subject: Re: [lwip-users] what is "defined() " ???
Date: Thu, 24 Jan 2008 09:58:04 +0100

Ok.... you are right!!! :O)

i read my compiler manual, and i didn' found anything about "#if defined(SYMBOL)"

after your advises, i tried a simple conditional compilation using it, and checked .LST file....
...yes... my compiler provide this preprocessing directive, but i didn't know it

Thanks to all... i think could be a useful understanding in my code developing

Piero.

2008/1/23, Bill Auerbach <address@hidden>:

I can't believe "defined" isn't supported, but anyway, a general workaround is:

 

For

 

#if defined( symbol ) || defined( symbol2 )

 

Add

 

#define defined

#ifndef symbol

#define symbol 0

#endif

#ifndef symbol2

#define symbol2 0

#endif

 

defined will be removed and all symbols will be their original value, or 0 if they don't exist.

 

Bill Auerbach

 


From: lwip-users-bounces+bauerbach=address@hidden [mailto:address@hidden] On Behalf Of Piero 74
Sent: Wednesday, January 23, 2008 12:11 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] what is "defined() " ???

 

i know preprocessing....

i have not defined() pre-processing directive in my compiler.

in general i use #ifndef SYMBOL

so.. i don't know how implement this macro...

suggests?

2008/1/23, Kieran Mansley <address@hidden >:

On Wed, 2008-01-23 at 17:19 +0100, Piero 74 wrote:
> Hi all
>
> in file socket .h i found this:
>
> #if !defined(FIONREAD) || !defined(FIONBIO)
>
> what is "defined" macro? have i to define in cc.h using compiler
> pragma?

I suggest reading an introduction to the C preprocessor - this sort of
question is probably better answered by getting the necessary background
knowledge, and isn't really specific to lwIP.

The line in question is saying "if whoever is using this file has
already defined a lot of the constants that we need, then skip this bit,
otherwise define all these constants that we need".  It allows the
sockets.h header to both be included where these values have been pre-
defined (e.g. in an OS that has its own sockets API) or in one where
they have not.

Kieran



_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]