2382 – spec is not clear on what is allowed as global/static initializers

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2382 - spec is not clear on what is allowed as global/static initializers
Summary: spec is not clear on what is allowed as global/static initializers
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: spec
Depends on:
Blocks:
Reported: 2008年10月01日 18:48 UTC by Tomas Lindquist Olsen
Modified: 2014年02月15日 13:12 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Tomas Lindquist Olsen 2008年10月01日 18:48:22 UTC
I can't find anywhere in the spec where it's clarified what can be used as a global/static initializer (only some special cases, like static struct initializers)
for example it's valid to initialize a global with the address of a function, statically. however, for example, it's not allowed to cast this function pointer to an integer even though there's no technical reason this should not be allowed.
Comment 1 Walter Bright 2012年01月22日 14:43:45 UTC
Casting a pointer to an int may require halving its size, and the object file format often does not support that.
Comment 2 github-bugzilla 2012年01月22日 14:45:31 UTC
Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org
https://github.com/D-Programming-Language/d-programming-language.org/commit/a23ff9898ceb21a5d6d861f7b884120f529fe631
fix Issue 2382 - spec is not clear on what is allowed as global/static initializers


AltStyle によって変換されたページ (->オリジナル) /