Good question. Only a couple of weeks ago I fixed a big object file bloat by moving stuff like this:

static assert(e1);
static assert(e2);
static assert(e3);

inside a unittest:

unittest
{
    static assert(e1);
    static assert(e2);
    static assert(e3);
}

I recall that the size of hello.o decreased from 30KB to 1.9KB.


Andrei

On 06/22/2010 01:10 PM, Steve Schveighoffer wrote:
I have a question.  When a template is used only for static checking, such as 
static asserts and template constraints, is it's typeinfo and paraphernalia 
included in the resulting executable?  I don't think it should be, otherwise 
bloat will ensue...

-Steve



----- Original Message ----
From: Andrei Alexandrescu<[email protected]>
To: Discuss the phobos library for D<[email protected]>
Sent: Tue, June 22, 2010 2:01:32 PM
Subject: Re: [phobos] phobos commit, revision 1678

Yes.

Andrei

On 06/22/2010 12:24 PM, Brad Roberts wrote:

Should all the ranges have that sort of static assert to make sure they
satisfy
the intended set of attributes?

On 6/22/2010
8:03 AM, Andrei Alexandrescu wrote:
I think just issuing an
assert(isForwardRange!(typeof(repeat(1))) should

suffice.

Andrei

On 06/22/2010
09:58 AM, David Simcha wrote:
Realistically, how would you
recommend testing something like this?  I
checked to make
sure that there was something instantiating each version
of the
structs to make sure that they compile (i.e. no silly syntax

errors), and as for the logical correctness, it seemed like the code
was
so trivial that it would  be silly to write an explicit
test for it.
Furthermore, the precedent in the rest of Phobos
seems to be that such
trivial code does not require
testing.

On Tue, Jun 22, 2010 at 10:30 AM, Brad
Roberts<
href="mailto:[email protected]";>[email protected]

<mailto:
href="mailto:[email protected]";>[email protected]>>
wrote:

      On 6/22/2010 5:31 AM,

href="http://dsource.org";>dsource.org<http://dsource.org>
wrote:
       >   phobos commit, revision
1678
       >

    >
       >   user:
dsimcha
       >

    >   msg:
       >   Bug
4362:  std.range.repeat and cycle do not have a .save()
method
       >

    >
http://www.dsource.org/projects/phobos/changeset/1678


     Don't forget to add unit tests. :)

   _______________________________________________

     phobos mailing list

ymailto="mailto:[email protected]";
href="mailto:[email protected]";>[email protected]<mailto:
ymailto="mailto:[email protected]";
href="mailto:[email protected]";>[email protected]>


http://lists.puremagic.com/mailman/listinfo/phobos





_______________________________________________
phobos mailing
list

href="mailto:[email protected]";>[email protected]

href="http://lists.puremagic.com/mailman/listinfo/phobos"; target=_blank
http://lists.puremagic.com/mailman/listinfo/phobos

_______________________________________________
phobos mailing
list

href="mailto:[email protected]";>[email protected]

href="http://lists.puremagic.com/mailman/listinfo/phobos"; target=_blank
http://lists.puremagic.com/mailman/listinfo/phobos


_______________________________________________
phobos mailing
list

href="mailto:[email protected]";>[email protected]

href="http://lists.puremagic.com/mailman/listinfo/phobos"; target=_blank
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos
mailing list

href="mailto:[email protected]";>[email protected]

href="http://lists.puremagic.com/mailman/listinfo/phobos"; target=_blank
http://lists.puremagic.com/mailman/listinfo/phobos



_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to