Board index » cppbuilder » Re: Ping ISO Guys

Re: Ping ISO Guys


2007-04-23 07:23:48 PM
cppbuilder100
Old Wolf wrote:
Quote
Someone else said that it is initialized on program startup. I
don't think this is correct: it is initialized the first time
My reading is that the memory must be allocated on startup but
initialization can be later (or never) if the compiler can determine
that the lack of initialization has no effect on the execution of the
program. So if it is a non-pod object compiler must be able to
determine that there are no side-effects to initialization.
- Leo
 
 

Re:Re: Ping ISO Guys

David Dean [CodeGear] < XXXX@XXXXX.COM >wrote:
Quote
In article < XXXX@XXXXX.COM >,
Leo Siefert < XXXX@XXXXX.COM >wrote:

>>As far as the standards, they're quoted here often.
>
>According to the Copyright notice they are in violation. Not sure
>about how that may be modified by the law, but it does say "no part".

I believe the quoting here falls under the "Fair use" doctrine, since
posters tend to quote small relevant sections with the intent to educate
others.

<en.wikipedia.org/wiki/Fair_use>
Whatever. It's regularily copied like this in
some newsgroups by committee members.
Schobi
--
XXXX@XXXXX.COM is never read
I'm HSchober at gmx dot org
"My hope is that if more people start reading books,
the world will become a better place."
froarulv in afp
 

Re:Re: Ping ISO Guys

"Hendrik Schober" < XXXX@XXXXX.COM >writes:
Quote
>I believe the quoting here falls under the "Fair use" doctrine, since
>posters tend to quote small relevant sections with the intent to educate
>others.
>
><en.wikipedia.org/wiki/Fair_use>

Whatever. It's regularily copied like this in
some newsgroups by committee members.
I'm not sure I understand your position on this. Do you disagree with
"fair use"?
--
Chris (TeamB);
 

{smallsort}

Re:Re: Ping ISO Guys

Chris Uzdavinis (TeamB) < XXXX@XXXXX.COM >wrote:
Quote
"Hendrik Schober" < XXXX@XXXXX.COM >writes:

>>I believe the quoting here falls under the "Fair use" doctrine, since
>>posters tend to quote small relevant sections with the intent to educate
>>others.
>>
>><en.wikipedia.org/wiki/Fair_use>
>
>Whatever. It's regularily copied like this in
>some newsgroups by committee members.

I'm not sure I understand your position on this. Do you disagree with
"fair use"?
I meant to say that, what Dean called "fair use", is
also common use, even amongst the authors of the text.
Schobi
--
XXXX@XXXXX.COM is never read
I'm HSchober at gmx dot org
"My hope is that if more people start reading books,
the world will become a better place."
froarulv in afp
 

Re:Re: Ping ISO Guys

JD wrote:
Quote
Leo Siefert wrote:
>
>Storage for local statics is the same as for global statics,

Certainly, it must be more specific(?).
Others have said that the "specific is that the memory remain for the
duration of the program. (ie. not specific at all)
Since the data is not initialized by the compiler, but at runtime by
the owning function, there is no reason to clutter the initialized
data segment with it. The uninitialized data segment, however, would
be the perfect location for it.
It might be that other archetectures don't suipport uninitialized
data, in which case, the Standard couldn't dictate it's use (guessing)
 

Re:Re: Ping ISO Guys

Leo Siefert < XXXX@XXXXX.COM >wrote:
Quote
Old Wolf wrote:

>Someone else said that it is initialized on program startup. I
>don't think this is correct: it is initialized the first time

initialization can be later (or never) if the compiler can
determine that the lack of initialization has no effect on the
execution of the program. So if it is a non-pod object compiler
must be able to determine that there are no side-effects to
initialization.
I read the text again, it is quite convoluted. I think what it is
saying is that for local static non-POD, it should be initialized
the first time that execution reaches the declaration. However,
if there are no side-effects of initialization then it can be
done earlier.
 

Re:Re: Ping ISO Guys

In article <462cc087$ XXXX@XXXXX.COM >,
"Hendrik Schober" < XXXX@XXXXX.COM >wrote:
Quote
I meant to say that, what Dean called "fair use", is
also common use, even amongst the authors of the text.
I don't see how those two things could be seen to be mutually
exclusive.
--
-David Dean
CodeGear C++ QA Engineer
<blogs.codegear.com/ddean/>
 

Re:Re: Ping ISO Guys

David Dean [CodeGear] < XXXX@XXXXX.COM >wrote:
Quote
In article <462cc087$ XXXX@XXXXX.COM >,
"Hendrik Schober" < XXXX@XXXXX.COM >wrote:

>I meant to say that, what Dean called "fair use", is
>also common use, even amongst the authors of the text.

I don't see how those two things could be seen to be mutually
exclusive.
Neither do I. :)
I must be doing something wrong, giving the
wrong impression...
Schobi
--
XXXX@XXXXX.COM is never read
I'm HSchober at gmx dot de
"My hope is that if more people start reading books,
the world will become a better place."
froarulv in afp
 

Re:Re: Ping ISO Guys

David Dean wrote:
Quote
I believe the quoting here falls under the "Fair use" doctrine,
Fair use is always subject to interpretation in different situations.
The classic fair use scenario is using quotes for a review or analysis
of the copyrighted material. But even in educational settings there
have been suits based on "handouts" containing copyrighted material
for study.
If, for instance, I were to be open to responding to any question like
the OP here with the relevant sections quoted from the standards
document, then I would be essentially serving as an intelligent search
engine. Such a service could easily be seen as cutting into the
potential market for sales of the document.
More likely, though, if Borland/CodeGear were to encourage this type
of responses in this newsgroup and it were to become known that one
could generally get quoted sections of the document by posting a
request to this group they could be subject to a law suit.
- Leo
 

Re:Re: Ping ISO Guys

Hendrik Schober wrote:
Quote
Whatever. It's regularily copied like this in
some newsgroups by committee members.
Sometimes, but then they are not the copyright holders. The copyright
is owned by ISO/IEC/ANSI/ITI, and that's who decides whether or not to
file a suit. Legally, they probably have the right to sue members of
the committee as well - depending upon the terms of the contract with
them.
- Leo
 

Re:Re: Ping ISO Guys

Leo Siefert < XXXX@XXXXX.COM >wrote:
Quote
Hendrik Schober wrote:

>Whatever. It's regularily copied like this in
>some newsgroups by committee members.

Sometimes, but then they are not the copyright holders. The copyright
is owned by ISO/IEC/ANSI/ITI, and that's who decides whether or not to
file a suit. Legally, they probably have the right to sue members of
the committee as well - depending upon the terms of the contract with
them.
I'm sure they have. But then, I'm also sure
the committee member know about this. Hence
me pointing out that they do it, too.
Quote
- Leo
Schobi
--
XXXX@XXXXX.COM is never read
I'm HSchober at gmx dot de
"My hope is that if more people start reading books,
the world will become a better place."
froarulv in afp
 

Re:Re: Ping ISO Guys

"Old Wolf" < XXXX@XXXXX.COM >writes:
Quote
I read the text again, it is quite convoluted. I think what it is
saying is that for local static non-POD, it should be initialized
the first time that execution reaches the declaration. However,
if there are no side-effects of initialization then it can be
done earlier.
I think you're right, except that it must be initialized before the
code is reached. Since constructors can throw, this "early"
initialization might not be a good idea, except when the compiler can
also prove that the code cannot throw.
(For static local objects that throw in their constructor, the next
time the function is called, the object will be attempted to be
initialized again, and so on, until the constructor succeeds.)
The early initialization is a nice feature when it can be implemented,
though, because the generated code can be much more efficient. The
static local variables not only need space for the object, but also
need a "flag" to indicate whether they've been initialized. This flag
is checked every time the function is called:
This:
void foo()
{
static MyObject obj;
//...
}
Would become equivalent to something like this:
static char vfoov_MyObject_foo[sizeof MyObject];
static bool vfoov_MyObject_foo_initialized = false;
void foo()
{
if ( ! vfoov_MyObject_foo_initialized )
{
new (vfoov_MyObject_foo) MyObject;
vfoov_MyObject_foo_initialized = true;
}
// ...
}
and then sometime in the cleanup code for that translation unit:
//...
if (vfoov_MyObject_foo_initialized)
{
vfoov_MyObject_foo.~MyObject();
}
(Note, I made them file-scoped statics because those have internal
linkage, and nobody in any other translation unit would need to see
the defintion of the static locals. The standard usually doesn't say
things about the implemention of features, and so this is not strictly
required, but how I'd do it were I writing the compiler. However, had
the function been inlined, it would have needed global access to the
data, since each inlined expansion of the function would need to view
the same memory, across translation units.)
If the compiler can prove that the object's construction cannot fail
and has no side effects, then it can simplify the generated code a
lot:
// initialized at normal program startup like any other "regular"
// global variable, except it's not directly accessible by the
// program code like global variables are.
static MyObject vfoov_MyObject_foo;
void foo()
{
// ...
}
The runtime benefit is that it can avoid all the checks to see if it's
initialized or not, and save storing the flag entirely. It's more
efficient in both runtime performance and storage requirements.
--
Chris (TeamB);
 

Re:Re: Ping ISO Guys

Leo Siefert < XXXX@XXXXX.COM >wrote:
Quote
Sometimes, but then they are not the copyright holders. The copyright
is owned by ISO/IEC/ANSI/ITI, and that's who decides whether or not to
file a suit. Legally, they probably have the right to sue members of
the committee as well - depending upon the terms of the contract with
them.
Well, that's the interesting thing - the contract. Or lack thereof. It's
all rather wonderfully vague, to be honest, because the panel members
contribute varying amounts of time and effort, create a standard with
very little support from ISO or the local chapters (e.g. BSI for the
UK), and don't get any financial return at all.
For the recent Oxford meeting, the money to provide meeting rooms,
refreshments, etc at the hotel came from corporate sponsors such as
Google, Adobe, HP and Microsoft, with ACCU agreeing to underwrite any
shortfall. Delegates had to find their own travel and accommodation
costs, and some were using vacation days to take the time off.
For a BSI C++ panel meeting (somewhat more frequent than the
thrice-a-year international meetings), BSI provide car parking, a
meeting room and access to a can{*word*249} for lunch which is cheaper than
going out, but still paid for.
(I can't speak for other national organisations here - I've only been to
BSI meetings.)
Then ISO and its local chapters sell the result.
I'm not saying that the above is a reason to rip off the copyright of
the standard, and I won't be giving anyone copies of the PDFs that I
have. But, of a document the size of the standard, the extracts seen
here are going to be of 'fair use' size in any reasonable jurisdiction.
In addition, the standard is very much an evolving document, and part of
that evolution is driven by the very ability of people to actually pick
at the text therein.
Alan Bellingham
--
ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK
 

Re:Re: Ping ISO Guys

"Old Wolf" < XXXX@XXXXX.COM >writes:
Quote
I read the text again, it is quite convoluted. I think what it is
saying is that for local static non-POD, it should be initialized
the first time that execution reaches the declaration. However,
if there are no side-effects of initialization then it can be
done earlier.
The famous "as if" rule.
Initialization must occur *as if* the object in question were
initialized when the execution reaches its declaration. If the program
can't tell, the initialization may occur at any other time or not at
all.
 

Re:Re: Ping ISO Guys

For certain things, initialization can throw an exception.
Unless the difficult job of saving all details related to the exception is
done, the "as if" for an item which can throw an exception must be done
right there and not "as if" it were right there.
. Ed
Quote
Thomas Maeder wrote in message
news: XXXX@XXXXX.COM ...

>I read the text again, it is quite convoluted. I think what it is
>saying is that for local static non-POD, it should be initialized
>the first time that execution reaches the declaration. However,
>if there are no side-effects of initialization then it can be
>done earlier.

The famous "as if" rule.

Initialization must occur *as if* the object in question were
initialized when the execution reaches its declaration. If the
program can't tell, the initialization may occur at any other
time or not at all.