Hitchikers Guide to Porting Phobos / D Runtime to other architectures

Johannes Pfau nospam at example.com
Wed Jan 8 07:25:08 PST 2014


Am Wed, 08 Jan 2014 13:31:07 +0000
schrieb "Adam D. Ruppe" <destructionator at gmail.com>:

> On Wednesday, 8 January 2014 at 07:57:29 UTC, Jacob Carlborg
> wrote:
> > Even if the struct isn't used or void-initialized?
> 
> Yeah.

The compiler can not know that a struct isn't used/void initialized.
With separate compilation TypeInfo is output in object A.o and could be
used from any other object. So only the linker actually knows for sure
if the TypeInfo is used (There are exceptions where even the linker
can't know that. Think of dynamic libraries).

There are 2 ways to solve this:
* Disable TypeInfo globally, everywhere (useful for embedded systems)
* Disable TypeInfo for specific types using some kind of annotation in
  the source code (pragma, UDA). This way the compiler knows if a type
  has TypeInfo or not and can complain if it'd need TypeInfo


More information about the Digitalmars-d mailing list