Curtis L. Olson writes:

> gethostbyname() returns NULL if an error occured.
> 
> Expressions such as (a = b + c) evaluate to whatever value is assigned
> to "a" so we can do things like
> 
> if ( a = b + c ) {
>   // a != 0
> } else {
>   // a == 0
> }
> 
> This is a little tricky, so if gethostbyname() fails, host_info will
> be assigned a value of NULL and the whole entire expression then
> evaluates to NULL so this should work (at least on systems that define
> NULL to be 0x00.)
> 

Thanks, I see whats going on now.  I don't particularly like it 
though! 

a = b + c;
if(a) {
...
} else {
...
}

seems like a much better construct to me - trading a touch of 
consiseness (is that a word?) for complete clarity as to the authors 
intent.

> That said, the entire NetworkOLK module is only half implimented, and
> not really useful at this point.  We really need someone to come along
> and finish it, or perhaps reimpliment this functionality from scratch
> using the plib networking libs.

I must confess I wasn't looking at doing anything with NetworkOLK, 
simply compiling with -Wall.

Cheers - Dave



--
[EMAIL PROTECTED]

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to