dive_trip_list & dive_table

Thiago Macieira thiago at macieira.org
Mon Apr 15 11:07:03 PDT 2013


On segunda-feira, 15 de abril de 2013 07.15.56, Dirk Hohndel wrote:
> > I *think* a global struct dive table would be initialised to contain PODs
> > with zero value, right [1] ? This might explain my first symption of nr ==
> > 0.
> 
> Yes, a global variable is zero initialized.

If the variables are in a C file, they can only be static initialised. They're 
either zero-initialised or initialised to a particular value. 

There's no dynamic initialisation. That only happens in C++. And please avoid 
it in C++ too. It increases the load time requirements and the initialisation 
order between different .cpp files ("translation units") is undefined. Also, 
strictly speaking, we should have the main() function in a .cpp file so that 
pre-main initialisation could be done, but the GCC ABI (the IA-64 C++ ABI) 
does not require that.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130415/761b774f/attachment.sig>


More information about the subsurface mailing list