This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: empty function optimizations


> From: Joe Buck [mailto:jbuck@racerx.synopsys.com]
>
> > Well, sure I could have
> > control but then that is like saying "don't
> > use templates".
>
> No, this is not true.  The technique you need to use is called partial
> specialization.
>
> Ideally, the STL we provide should use a lot more partial specialization;
> for example

Fair enough, and the Stroustrup pointer will come in handy, but I think we
have a difference in philosophy on this.  If I end up with duplicate code
for whatever reason, I'd like the linker to catch it.  In RL programmers
don't always have complete control over the templates they play with
(including STL), and in RL programmers leave creeping bloat well enough
alone (there are 2854 "simple functions" in Linux).

I also don't like void* solutions as a general rule, but I'll admit hiding
it up in a type-safe template library is probably a reasonable exception.

> > I understand this could break conforming programs, but honestly
> I have to
> > say comparing function pointers for equality is in pretty bad taste
> > (entirely IMHO).
>
> That's the least of the problems.  You seem to want the compiler or linker
> to figure out for you that, say, vector<unsigned> and vector<float> can
> share the same code for the copy constructor, because on your platform,
> both are four bytes and it's just data movement.

If float and int assignment are treated differently by the arch, then I
don't expect anything.  I *do* expect that operations on node pointers that
happen to contain an int or float to get combined if it results in the same
code.  Or at least it would be nice :-).

Ken


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]