std/c/time.d const sysconf bug?

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sun Jan 7 09:56:18 PST 2007


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Dawid Ci??arkiewicz schrieb am 2007-01-07:
>> $ dmd
>> Digital Mars D Compiler v1
>> ...
>>
>>
>> $ make
>> + /home/dpc/stg/d/bin/dsss_build -I/home/dpc/stg/d/include/d -LIBPATH=/home/dpc/stg/d/lib/ -LIBPATH=./  -od. 
>> server.d -Tserver
>> /home/dpc/stg/d/include/d/std/c/time.d(40): Error: non-constant expression
>> (sysconf)(2)
>>
>> else version (linux)
>> {
>>     extern (C) int sysconf(int);
>>     const clock_t CLK_TCK = cast(clock_t) sysconf(2); // <---------- THIS
>> }
> 
> Please replace the line with:
> clock_t CLK_TCK(){ return cast(clock_t) sysconf(2); }
> 
> Using "static this" would work for common use-cases but not if
> running applications are beeing migrated between different systems.

My first instinct when I read that message was to post just such a 
reply, but then I noticed he wasn't talking about his own code. This is 
in Phobos's std.c.time module...


More information about the Digitalmars-d-bugs mailing list