|
From: jeroen <je...@fo...> - 2001-12-14 01:26:10
|
On Thursday 13 December 2001 04:06, you wrote:
> Hi,
>
> I found a small bug in the extended version of FXTreeList.
>
> The line 132 in FXTreeList.cpp is now:
>
> if(x+icon->getWidth()+(SIDE_SPACING/2)<off && icon){
>
> and it should be:
>
> if(icon && x+icon->getWidth()+(SIDE_SPACING/2)<off){
>
> This caused the thing to crash when icons were not used. Do you know if
> it's always guaranteed that if the first part of the statement (icon) is
> not true, then the latter part is not evaluated in AND case? I would
> assume that it's up to the compiler to be smart enough, right?
&& and || evaluate left-to-right, and are "lazy" in the sense that for
an expression A && B, if A is known to be false then B is not even tried.
Likewise for A || B, if A is true then B is not even tried.
It allows you to write great cryptic if statements like:
a && b();
In terms of job-security, you just gotta love that :-)
=====
Talking about programmer's humor, did you know the GNU C library
has a function called:
char *strfry(char *string);
DESCRIPTION
The strfry() function randomizes the contents of string by using rand(3) to randomly swap
characters in the string. The result is an anagram of string.
RETURN VALUE
The strfry() functions returns a pointer to the randomized string.
CONFORMING TO
The strfry() function is unique to the Linux C Library and GNU C Library.
=====
- Jeroen
|