[RFC] Proper initialization of class members and variables

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sat Nov 19 10:11:25 GMT 2005


Hi,

I get a lot of trouble because of unitialised variables when using msvc.
This is because gcc seems to auto-initialize all vars with '0' but msvc
does not (in debug it fills all with 0xcd).
My question is if autoinitialization is a c++-standard (and msvc ignores
it) or if this is a gcc feature.
If this is a gcc feature, you should avoid it and initialize all
variables before use because you never know how other compilers
initialize the memory (and imho it's not a good coding style to not
initialize variables before use).

I've attached a small patch to fix this for
kdelibs/kdecore/ksycocafactory.cpp

Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ksycoca.patch
Type: text/x-diff
Size: 458 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051119/781c3961/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051119/781c3961/attachment.sig>


More information about the kde-core-devel mailing list