Program size, linking matter, and static this()

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Dec 16 14:58:51 PST 2011


On 12/16/11 2:58 PM, Jonathan M Davis wrote:
> Unfortunately, the necessity of tzset would remain however.

Why? From 
http://pubs.opengroup.org/onlinepubs/007904875/functions/tzset.html:

"The tzset() function shall use the value of the environment variable TZ 
to set time conversion information used by ctime(), localtime(), 
mktime(), and strftime(). If TZ is absent from the environment, 
implementation-defined default timezone information shall be used."

I'd expect a good standard library implementation for D would call 
tzset() once per process instance, lazily, inside the wrapper functions 
for the four functions above. Alternatively, people could call the 
stdc.* versions and expect tzet() to _not_ having been called.

That strikes the right balance between convenience, flexibility, and 
efficiency.


Andrei


More information about the Digitalmars-d mailing list