On Wed, Nov 21, 2012 at 7:07 AM, Tobias Grosser <tob...@grosser.es> wrote:
> On 11/20/2012 08:32 PM, Basile Starynkevitch wrote:
>>
>> On Tue, Nov 20, 2012 at 11:24:40AM -0800, Lawrence Crowl wrote:
>> [....]
>>>>>
>>>>> All of these functions come in two forms.
>>>>>
>>>>>       function (FILE *, item_to_dump, formatting)
>>>>>       function (item_to_dump, formatting)
>>
>>
>> Since we have switched to C++, it would be really nice to have dump
>> functions
>> writing to a C++ std::ostream
>
>
> If I understood correctly, including iostream may (depending on your c++
> library) introduce static constructors in every translation unit.

This is obviously false on the face of it. Only the translation that includes
iostream gets the niftty counters.

Furthermore, not including iostream does not mean you don't
get static constructors -- GCC has lot of global variables and if
any of them incures dynamic initialization, you get
dynamic initialization.  Note also that if you explicitly delay
initialization to runtime, you are going to pay for it anyway
through brittle manual initialization.

> This could
> negatively impact the startup time of gcc.

Do you have concrete data point on this specific case?
(I am not asking for artificial benchmark)

The cost you get with iostream isn't with dynamic
intiialization, it is with something else (notably locales.)

> LLVM explicitly forbids the use. If we allow it, it would be good if a more
> knowledgeable person thought about the possible overhead.

LLVM forbids lot of good things.  If your competition is LLVM, you don't
win by repeated the same mistakes.

-- Gaby

Reply via email to