[Bf-python] [ #2074 ] Blank GUI String field Crashes Blender

Yann Vernier yann at algonet.se
Wed Feb 16 12:26:04 CET 2005


On Tue, Feb 15, 2005 at 10:04:47AM -0900, Tom M wrote:
> char *name, *tip = NULL, *newstr ;
> char *name, *tip, *newstr = NULL ;
> 
> The first is apparently valid according to the C spec, but the gcc
> compiler apparently doesn't like it.

Both are perfectly valid C; one leaves tip set to NULL, the other leaves
newstr set to NULL. In both cases the other two are uninitialized and
should not be relied on to have any useful value.

The exception is in the case of the variables being static or global. In
that case the other two go into the bss section, and should be
initialized to 0. There's some other whackiness in how 0 is possibly not
a machine-specific encoding of NULL but NULL is always represented by 0
in source, but essentially: initialize precisely the things you want
initialized.

-- 
PGP fingerprint = 9242 DC15 2502 FEAB E15F  84C6 D538 EC09 5380 5746
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20050216/8f527760/attachment.sig>


More information about the Bf-python mailing list