Re: [PATCH] rivafb bugfixes

wsuetholz@centonline.com
Wed, 28 Jun 2000 12:02:24 -0500 (CDT)


On 28-Jun-00 Jeff Garzik wrote:
>
> Looks ok except for one small thing: do not explicitly initialize these
> to zero, they are automatically zeroed. If not, it is a bug...
>
> If TNT owners report success I will apply.
>
> Jeff
>

What do you mean don't initialize variables??? If you don't, then on some
OS's you will get random garbage in the variable. Granted Linux currently seems
to initialize your memory to zeroes, but do you really want to depend on that?
EVEN a null string could return random characters if you check == '\0' instead
of == NULL (or is it == (char *)NULL). Again it all depends on the OS. On SVR3
and SVR4 the value pointed to by NULL is random garbage, not character 0.

What I'm trying to say, is that it is always good programming practice to
initialize variables, and not depend on a "feature" of your current OS.

For example recently the TN5250 group have been tracking down portability
problems because of this very thing, they developed under linux, and when
porting to UnixWare (SVR4.2) they had some uninitialized variables cause
problems.

Bill Suetholz

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/