On Tue, Jun 25, 2002 at 01:28:39PM -0400, Kevin OKeefe wrote:
> The way you want to check this is:
> 
> if(tempcharstar)
> {
>       if(*tempcharstar)
>       {
>               StrCopy(string, tempcharstar);
>       }
> }
> 
> or,
> 
> if(tempcharstar && *tempcharstar)
>       StrCopy(string, tempcharstar);
> 
> 
> First see if the pointer is not NULL (there is a pointer), then, if there is a 
>pointer, see if there is a character in there (it's actually pointing at a string).  
>The second method depends on the compiler evaluating the left-hand side before the 
>right, which I believe is a decent assumption.

It's called short circuit evaluation, and it's mandatory in C for
every compiler (for logical binary operators).

Marco

-- 
========================================================================
Marco Pantaleoni                                  [EMAIL PROTECTED]
Padova, Italy                                              [EMAIL PROTECTED]
elastiC language developer                   http://www.elasticworld.org

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to