Assignment operator=/copy constructor/temporaries, BROKEN!

  • Thread starter Fabrizio J Bonsignore
  • Start date
J

Joshua Maurice

What is assumed is that
AO Function() {return AO();}
AO x = Function();

is equivalent to, or _after optimization_ becomes equivalent to:

AO *pFunction() {return new AO;}

AO &x = *pFunction();
//this is unavoidable but system generated
Remember_System_ToCallDeleteOnThisParticularReferenceObjectsMemory(x);

but is treated as if it was:

T x = foo();

My problem _includes_ pass by value from a function.  In the actual
working code I unearthed this bug problem, currently it even seems
there is an EXTRA call to a destructor that is generated by this
temporary optimization, but AFTER the system exits, that may be
matching the spureous message:

no match for 'operator=' in 'f = BO::Retit()()',

after adding const solved the compiling problem (at the expense of
threatening to dichotomize the rest of the library with calls to const
and const_casts).


My point is still that the compiler implementation is confused by the
temporary (optimization) and ends up looking and asking an illegal
constructor signature and/or posts other ambiguous error messages, and
this error was found when using an initialization idiom.

What you describe is horribly broken.

Let's take the example:

T foo()
{ T y;
//do stuff
return y;
}

int main()
{ T x = foo();
}

A good compiler will transform the previous code into the following
(pseudo-)code:

void foo(T * retval)
{ new (retval) T;
//do stuff
}

int main()
{ //use compiler magic to not invoke constructor here.
T x;

//instead, the constructor will be invoked inside foo
foo( & x );
}

Voila. No additional dynamic memory allocation is done.

Your understanding of (named) return value optimization and copy
constructor elision is horribly flawed, and your compiler may also be
horribly broken. What compiler are you using? Move to a non-broken
compiler.
 
J

James Kanze

What is assumed is that
AO Function() {return AO();}
AO x = Function();
is equivalent to, or _after optimization_ becomes equivalent to:
AO *pFunction() {return new AO;}
AO &x = *pFunction();
//this is unavoidable but system generated
Remember_System_ToCallDeleteOnThisParticularReferenceObjectsMemory(x);

Who assumes that? Such a transformation isn't allowed in C++.
Temporaries aren't allocated on the heap.

The usual (but not required) solution when the return type is
a class type is to reserve memory for it at the call site, and
pass a pointer to it as a hidden argument to the function. The
function then constructs the returned object in this memory, and
the caller accesses it after the function has returned.

The caller also has to ensure that any destructors are called at
the appropriate moment.

If the returned object is immediately used to copy construct
a local object, the compiler is allowed to optimize this copy
out, and pass the address of the local object as the hidden
argument. Mapped to C, something like:

A0 function() { return A0(); }
A0 x = function();

might give something like:

void function(void* pResult) { A0_ctor(pResult); }
and
function(&x);

(The actual space for x will typically be allocated on the stack
at the start of the function.)
but is treated as if it was:
T x = foo();

What is treated thus?
 
F

Fabrizio J Bonsignore

Sorry, but you are out of luck here. The C++ language does not allow
it.

Yeah, but a compiler is not the language nor viceversa.
The const-qualification may be optional to be able to create a well-
formed copy-constructor, but that does not mean the const is optional
for all usage patterns of the copy-constructor.
When the source of the copy is a temporary (such as the return value
from a function call), then the const-qualification is most definitely
NOT optional.

It sounds like lazy compiling. const means a contract between the
class designer and its users that X object in the language will not
change its state by a call and/or will not generate side effects. The
way you justify it it means that const has the additional meaning of
remembering the compiler that such objects memory must not be garbaged
away in the middle of the current function call! It does seem like an
onerous way to control a _possible_ optimization _flag_. Unfortunately
asking for no optimizations did not send the error away. In my
problematic implementation const declarations right away flagged
method 'bool HasMsg()' as needing const to compile too in one
compilation. It is a simple inline boolean logic method deciding on
the contents of an anonymous union, but I still remember the 'cannot
call const X method on non const object' error popping everywhere
once...

This statement is typical, assigning to a new object from a member and
viceversa within a call. b and a are defined in different scopes. It
hides this temporary-copy constructor problem if you use this idiom
exclusively.

Is your compiler choosing AO::AO(AO &) or AO::AO(const AO &) here? See
below.
(snip)
Error: No suitable constructor for constructing m from a temporary.
Available, but rejected constructors are:
A0::A0(void)
A0::A0(A0&)
Minimal required, but missing constructor is 'A0::A0(const A0&)'

Another compiler. I got differential error messages whether the
returned object was an in-function temporary or a member object!
Minimal required, but missing constructor is 'A0::A0(const A0&)'

Does it mean it requires all three constructors to be present? In my
case, omitting the assignment operator= and const in the copy
constructor fails statements:

AO m = Retit(); //no matching function for call to `AO::AO(AO)'
AO o( Retit() ); //returns a class member

AO f;
f = Retit();

but accepts

AO g = Retut();//!!! returns a temporary built in the stack

It seems that g++ takes member 'AO a' as being inherently const! So AO
g = Retut() takes AO::AO(AO &) as if it was AO::AO(AO const &);
because 'a' is const-ant and will not go away in the middle of the
computation. But f = Retit() where an in-function temporary is
returned failed. This seems to be related to the other failed
compilation where

AO g = Retut();

FAILS, but then

AO j = g;

passes! This statement should fail with a message like 'no variable g
defined' or similar, but it _temporarily_ accepts g as being well
built! This can be explained if the schizophrenic compiler managed to
build g with given constructors, then complains because it could not
build g with a _preferred_ constructor somebody told it should be The
Option, then finds the object built and uses it, then... Does GNU have
a regression tool? Something that would save together code and
compilation results automatically? Like in, for every Compile & Run
call the tool saves the code beign compiled, then the compilation
results and stores both under a name different from the next
compilation command... it would be useful to catch spureous error
messages and order dependencies and... etc.

There are three kinds of people in this world: those I care for, those
who know me who dislike me, and those who dont belong to these
categories. Who would be responsible for this problem? If there is
anyone from the first two categories as responsible, it is a personal
problem! In 2004 after my computer was stolen, if I had had access to
a new computer I would have tried compiling my backups with g++...
only to find several well tested sources not compiling for sure.
Failing to compile would have been _proof_ that I was not the author
of my own code! **He cannot even compile it, he does not know how to
program, it is not his code...**, would have sound like a true
statement, but the fault would have been the different compiler! This
reminds me of the case with Plauger, published in CUJ, where he
decided on the authorship of some code based on hidden space
characters at the end of lines. Those spaces are spureous, they depend
on your fingers habits and some editor flags and not everybody would
be aware they could be exposed; I already lost the typing mania of
deleting them... But it was the deciding factor in that case! I can
see the scenario: have somebody make a small change in the widely
acclaimed, open source available, public GNU g++ compiler of choice,
knowing it would brake some _specific_ code, ignore bug reports for a
while, engage in a new version, add complex features, ignore some more
bug reports, shield on the standard, blame new features, recommend
next version just about to be released before accepting anything, and
by the time the problem is finally recognized somebody already lost
its _competitive_ _advantage_, code has to be rewritten, released
accusations of you do not know how to program, CTOs involved, time
wasted, money spent...

For several circumstances I did not notice the theft immediately nor
got access to a computer in the meanwhile, but it could have even
landed me in jail at the time!!! Try explaining why you cannot compile
your own sources and that your computer was stolen to a policeman or
an unconvinced lawyer during the emergency, when somebody else has
your code compiling and even here some people do not admit that the
widely acclaimed, open source available, public GNU g++ compiler of
choice is complaining about 'Retut()()' [note double parenthesis]!! It
is a really erred error message. At least it would have given the
people who have my code time to learn how to use it but they could
have achieved some really unfair advantage. This code I am writing is
new so there is no chance of something like that happening... maybe,
but I expected to have three classes ready in less than four hours...
two weeks ago. Things change, though, if somebody who knows me is
involved! If it was somebody I care for, it is a double trap and a
responsible is behind the scenes; if it is somebody who knows me and
dislikes me, it is criminal sabotage! If neither, it is still open to
liabilities because of criminal intent, and I would still expect a
very simple set intersection to be NULL too. But if besides THIS case
is the excuse... proven.

It is obvious the language needs a copy contructor and because of
singletons (static variables) it needs to do without const copy
contructors legally and without trouble, at will, which besides is
recognized by the standard it pretends to support.

Danilo J Bonsignore
 
K

Kai-Uwe Bux

Fabrizio said:
Yeah, but a compiler is not the language nor viceversa.


It sounds like lazy compiling. const means a contract between the
class designer and its users that X object in the language will not
change its state by a call and/or will not generate side effects. The
way you justify it it means that const has the additional meaning of
remembering the compiler that such objects memory must not be garbaged
away in the middle of the current function call! It does seem like an
onerous way to control a _possible_ optimization _flag_. Unfortunately
asking for no optimizations did not send the error away.
[...]

The rule [8.5.3/5], which prohibits initializing a non-const reference from
a temporary is not meant to control optimization. Rather, the rationale for
this rule includes cases like the following:

void inc_3 ( double & d ) {
d += 3.0;
}

...

int x;
inc_3( x );

With [8.5.3/5], this will trigger a compilation error: the double& argument
to inc_3() cannot be initialized with the temporary int obtained from the
int x by implicit conversions. The alternative would be that the temporary
is incremented by 3 and forgotten immediately afterwards.

Since the latter is usually not the programmers intent, the standard opted
for making the code illegal. Unfortunately, this causes all sorts of other
surprises, but at the root of it lie the pitfalls of automatic conversions.


Best

Kai-Uwe Bux
 
F

Fabrizio J Bonsignore

For several circumstances I did not notice the theft immediately nor
got access to a computer in the meanwhile, but it could have even
landed me in jail at the time!!! Try explaining why you cannot compile
your own sources and that your computer was stolen to a policeman or
an unconvinced lawyer during the emergency, when somebody else has
your code compiling and even here some people do not admit that the
widely acclaimed, open source available, public GNU g++ compiler of
choice is complaining about 'Retut()()' [note double parenthesis]!! It
is a really erred error message. At least it would have given the
people who have my code time to learn how to use it but they could
have achieved some really unfair advantage. This code I am writing is
new so there is no chance of something like that happening... maybe,
but I expected to have three classes ready in less than four hours...
two weeks ago. Things change, though, if somebody who knows me is
involved! If it was somebody I care for, it is a double trap and a
responsible is behind the scenes; if it is somebody who knows me and
dislikes me, it is criminal sabotage! If neither, it is still open to
liabilities because of criminal intent, and I would still expect a
very simple set intersection to be NULL too. But if besides THIS case
is the excuse... proven.

You see? I leave the cafeteria with a fully charged laptop battery in
hibernation; six hours of sleeping time later I find the battery is at
78%... I WANT SOMEBODY TO FIND WHO HAS TO PRETEND HE IS I AND HAS NOT
STOPPED STEALING MY CODE FOR THE LAST DECADE OR SO. Six years in NYC.
This has been ignored by the city council, the ombudsman office, the
city government, the Department of Justice, other federal offices, the
FBI, Columbia and other similar universities, the State Department,
the local congressman, the local DA office, the NY DA office, US
embassies in other countries, the NY State congress, the NY federal
congress representative, the NY federal senator office, other senators
and congress s office in other states, a few companies and of course
the local police.

Danilo J Bonsignore
 
F

Fabrizio J Bonsignore

The rule [8.5.3/5], which prohibits initializing a non-const reference from
a temporary is not meant to control optimization. Rather, the rationale for
this rule includes cases like the following:

  void inc_3 ( double & d ) {
    d += 3.0;
  }

  ...

  int x;
  inc_3( x );

With [8.5.3/5], this will trigger a compilation error: the double& argument
to inc_3() cannot be initialized with the temporary int obtained from the
int x by implicit conversions. The alternative would be that the temporary

What does this have to do with constructors? (...) A competent
programmer can debug such errors in no time without having to force
everybody else, everywhere else, to avoid language constructs, and
dichotomize code. The rationale is not good, though logical. The error
in your example is TYPE MISMATCH, not the temporary nor the reference
to modifier _double_ obtained from the implicit conversion to make the
statement work. It should be a supressable warning at most, the
implicit, not cast, conversion. But my problem is still that the
compiler did not recognize a valid constructor, asked for an illegal
one, shows other inconsistencies and errors, then my decade long
tested code would have been uncompilable like that...

Danilo J Bonsignore
 
F

Fabrizio J Bonsignore

What you describe is horribly broken.

Let's take the example:

  T foo()
  { T y;
    //do stuff
    return y;
  }

  int main()
  { T x = foo();
  }

A good compiler will transform the previous code into the following
(pseudo-)code:

  void foo(T * retval)
  { new (retval) T;
    //do stuff
  }

  int main()
  { //use compiler magic to not invoke constructor here.
    T x;

    //instead, the constructor will be invoked inside foo
    foo( & x );
  }

Voila. No additional dynamic memory allocation is done.

Your understanding of (named) return value optimization and copy
constructor elision is horribly flawed, and your compiler may also be
horribly broken. What compiler are you using? Move to a non-broken
compiler.

Elision is optional. I want the copy constructor to be invoked! In
fact I assume it, NOT the assignment operator after a default
constructor, as would be really correct. But code dependent on a
compiler flag to work is not really solid. Precisely, something was
broken! Moving to a new compiler is not a feasible solution in this
case for several reasons, but having its implementors correct these
bugs is. Paradoxically optimization would become evident in this
system s particular case once finished.

Danilo J Bonsignore.
 
K

Kai-Uwe Bux

Fabrizio said:
The rule [8.5.3/5], which prohibits initializing a non-const reference
from a temporary is not meant to control optimization. Rather, the
rationale for this rule includes cases like the following:

void inc_3 ( double & d ) {
d += 3.0;
}

...

int x;
inc_3( x );

With [8.5.3/5], this will trigger a compilation error: the double&
argument to inc_3() cannot be initialized with the temporary int obtained
from the int x by implicit conversions. The alternative would be that the
temporary

What does this have to do with constructors?

It's the rule [8.5.3/5] which requires the compiler to consider only copy-
constructors that use const-reference arguments in all places where the
copy-constructor is invoked to construct an object from a temporary.
(...) A competent
programmer can debug such errors in no time without having to force
everybody else, everywhere else, to avoid language constructs, and
dichotomize code. The rationale is not good, though logical.

You are free to file a defect report with the committee.
The error
in your example is TYPE MISMATCH, not the temporary nor the reference
to modifier _double_ obtained from the implicit conversion to make the
statement work.

Given the way implicit conversions are defined in the standard, there is no
type mismatch.
It should be a supressable warning at most, the
implicit, not cast, conversion. But my problem is still that the
compiler did not recognize a valid constructor, asked for an illegal
one, shows other inconsistencies and errors, then my decade long
tested code would have been uncompilable like that...

Please understand the implications of [8.5.3/5] in the context of copy-
constructors. The code you posted originally is not supposed to compile, and
the compiler _correctly_ rejects it.


Best

Kai-Uwe Bux
 
F

Fabrizio J Bonsignore

You are free to file a defect report with the committee.

I already tried reaching the publisher, GNU (generally not useful?),
Given the way implicit conversions are defined in the standard, there is no
type mismatch.

To enforce style, warning about implicit conversions is a solution,
whatever way they are defined.
Please understand the implications of [8.5.3/5] in the context of copy-
constructors. The code you posted originally is not supposed to compile, and
the compiler _correctly_ rejects it.

From my point of view, it is supposed to compile in other compilers
because it has compiled in an _industry_ standard compiler, though
economics tell me that the GNU g++ has to be of lesser quality because
it is free. To sacrifice working code for a bad ideal definition is
bad practice.

Danilo J Bonsignore
 
K

Kai-Uwe Bux

Fabrizio said:
I already tried reaching the publisher, GNU (generally not useful?),

Your are barking up the wrong tree. G++ is _correctly_ (at least in this
regard) implementing the C++ rules as given by the International Standard
ISO14882.

What you dislike are the consequences of clause [8.5.3/5] of that standard.
You would have to file a defect report about clause [8.5.3/5] of the
standard with the committee maintaining and updating the standard.
Given the way implicit conversions are defined in the standard, there is
no type mismatch.

To enforce style, warning about implicit conversions is a solution,
whatever way they are defined.
Please understand the implications of [8.5.3/5] in the context of copy-
constructors. The code you posted originally is not supposed to compile,
and the compiler _correctly_ rejects it.

From my point of view, it is supposed to compile in other compilers
because it has compiled in an _industry_ standard compiler, though
economics tell me that the GNU g++ has to be of lesser quality because
it is free. To sacrifice working code for a bad ideal definition is
bad practice.

If it had compiled with other compilers, the other compilers would have a
bug. G++ is _correctly_ rejecting the code. Could you name some compilers
which with the code upthread compiles?

Whether the code _should_ be illegal is a different issue. But given
ISO14882, the code _is_ illegal and any compliant C++ compiler must reject
it. That is why your question whether the code _should_ compile is not
properly directed toward compiler vendors but to the organization
maintaining the C++ standard.


Best

Kai-Uwe Bux
 
J

Joshua Maurice

You are free to file a defect report with the committee.

I already tried reaching the publisher, GNU (generally not useful?),
Given the way implicit conversions are defined in the standard, there is no
type mismatch.

To enforce style, warning about implicit conversions is a solution,
whatever way they are defined.
Please understand the implications of [8.5.3/5] in the context of copy-
constructors. The code you posted originally is not supposed to compile, and
the compiler _correctly_ rejects it.

From my point of view, it is supposed to compile in other compilers
because it has compiled in an _industry_ standard compiler,

The earlier versions of MSVC which accepted this hack were not
industry standards. The compiler which compiled code with the hack was
not an industry standard. Microsoft is notorious for providing
extensions and such to achieve vendor lock-in. You were coding to a
hack, an extension to the industry standard, an extension to the
official ANSI ISO C++ standard, and an extension to the de facto
standard as widely practiced then and now. When code using the hack no
longer works, you have no one to blame besides yourself (and I suppose
you could also blame the poor earlier versions of MSVC which IIRC had
the hack enabled as default).
though
economics tell me that the GNU g++ has to be of lesser quality because
it is free. To sacrifice working code for a bad ideal definition is
bad practice.

Not all things in this world which are worthwhile cost money. Perhaps
there is a correlation between money cost and value, but your blanket
claim without allowance for exceptions is incorrect. [/end off-topic
economics rant]
 
F

Fabrizio J Bonsignore

The earlier versions of MSVC which accepted this hack were not
industry standards. The compiler which compiled code with the hack was
not an industry standard. Microsoft is notorious for providing
extensions and such to achieve vendor lock-in. You were coding to a
hack, an extension to the industry standard, an extension to the
official ANSI ISO C++ standard, and an extension to the de facto
standard as widely practiced then and now. When code using the hack no
longer works, you have no one to blame besides yourself (and I suppose
you could also blame the poor earlier versions of MSVC which IIRC had
the hack enabled as default).

Very interesting... I meant the Borland compilers. When was the
standard effectively issued? I mean the period between 1992 and 2004
when I also used djgpp to extend through a IE hosted command line and
had no trouble at all whatsoever with the compiled code or its
versions. I agree on standards. I disagree standards are Human free!
Hard distinction between vendor and standard though, but that
discussion almost reaches philosophy because the standard is an
abstraction and the compiler IS-A de facto. But I DO have the
impression I MAY know some person in the committee and it IS precisely
the people I complained for years they CANNOT admit my code was
working way before they got involved with it AGAINST MY consent. But
that is only a personal doubt, no problem there, right? Being a
standard does not mean it is free of personal agendas or non market
competitions.

Currently in the problematic system, I only needed ONE const in ONE
copy constructor, the innermost object s one, to have the full three
classes, assignment operator= and copy constructors and all, compile
and run. Did not need all three to six methods using const!
though
economics tell me that the GNU g++ has to be of lesser quality because
it is free. To sacrifice working code for a bad ideal definition is
bad practice.

Not all things in this world which are worthwhile cost money. Perhaps
there is a correlation between money cost and value, but your blanket
claim without allowance for exceptions is incorrect. [/end off-topic
economics rant]- Hide quoted text -

So... can I have my own compiler version without the issue (with the
industry standard hack), tomorrow before noon, please? The argument is
hard and not easy. But it is better than the ad bacculum fallacy: it
is the ISO standard and you take it takes you. I would appreciate some
indication as to how to file a defect report, because this almost
amount to a report!

Danilo J Bonsignore
 
Ö

Öö Tiib

For several circumstances I did not notice the theft immediately nor
got access to a computer in the meanwhile, but it could have even
landed me in jail at the time!!! Try explaining why you cannot compile
your own sources and that your computer was stolen to a policeman or
an unconvinced lawyer during the emergency, when somebody else has
your code compiling and even here some people do not admit that the
widely acclaimed, open source available, public GNU g++ compiler of
choice is complaining about 'Retut()()' [note double parenthesis]!! It
is a really erred error message. At least it would have given the
people who have my code time to learn how to use it but they could
have achieved some really unfair advantage. This code I am writing is
new so there is no chance of something like that happening... maybe,
but I expected to have three classes ready in less than four hours...
two weeks ago. Things change, though, if somebody who knows me is
involved! If it was somebody I care for, it is a double trap and a
responsible is behind the scenes; if it is somebody who knows me and
dislikes me, it is criminal sabotage! If neither, it is still open to
liabilities because of criminal intent, and I would still expect a
very simple set intersection to be NULL too. But if besides THIS case
is the excuse... proven.

You see? I leave the cafeteria with a fully charged laptop battery in
hibernation; six hours of sleeping time later I find the battery is at
78%... I WANT SOMEBODY TO FIND WHO HAS TO PRETEND HE IS I AND HAS NOT
STOPPED STEALING MY CODE FOR THE LAST DECADE OR SO. Six years in NYC.
This has been ignored by the city council, the ombudsman office, the
city government, the Department of Justice, other federal offices, the
FBI, Columbia and other similar universities, the State Department,
the local congressman, the local DA office, the NY DA office, US
embassies in other countries, the NY State congress, the NY federal
congress representative, the NY federal senator office, other senators
and congress s office in other states, a few companies and of course
the local police.

If what you wrote here was not meant as some strange humor (i do not
understand) ... then I suspect that you may need help from specialists
of health care. Probably you have worked lately too much ... consumed
too much caffeine or something like that. All people need to rest too
otherwise it gets messy after a while.

Here in c.l.c++ group we discuss and give advice to other people about
c++ for free. In hope that it helps them to be successful too. In no
way we have need to sabotage others or even worse ... steal from
them.
 
F

Fabrizio J Bonsignore

If what you wrote here was not meant as some strange humor (i do not
understand) ... then I suspect that you may need help from specialists
of health care. Probably you have worked lately too much ... consumed
too much caffeine or something like that. All people need to rest too
otherwise it gets messy after a while.

Here in c.l.c++ group we discuss and give advice to other people about
c++ for free. In hope that it helps them to be successful too. In no
way we have need to sabotage others or even worse ... steal from
them.>

Oh, that s a typical denial reaction to disregard what is a formal
accusation when I AM living it and... It seems there is a concerted
effort to standardize the language but in contraposition to actual
practice! In opposition to established and successful vendors,
programmers, magazines, applications and even the inventors of the
language! It was invented in laboratories in Xerox Palo Alto, right?
From the same group of people who invented the Windows interface that
was supposedly **snatched** from them by Mac then **stolen** by Gates
for Windows when IBM **lost** the PC patent when everybody was
**learning** programming? (The Windows interface was not
standardized!) Is the language also being standardized as opposition
to its original designers from those laboratories in the seventies? I
havent seen the document, I expect it to have a EBNF grammar and even
a formal mathematics series of proofs, but I ve read enough about its
clauses that I wonder... the committee already developed a CULTURE, so
it is not easy to change nor criticize, but clauses do seem to turn
discussions about the language into a sort of legalese looking
engineerish court and all is said. Which incidentally does NOT seem to
be the same regarding other ISO products more **thing oriented**.
Language sounds easy for all... But it does seem there is a lag of
around three to more years between a committee statement and its
adoption by actual practice, despite almost real time discussions,
despite discussions, and that s a lot of time to add some Human spice
to the rumba, I mean, salsa. HTML was also standardized and became SO
COMPLEX that Flash is everything! The problem in this thread is quite
problematic... it has a psychological effect similar to the difficulty
to learn very similar languages as distinct languages; if you already
have a mindframe, relearning changes is problematic and even
impossible! Consider that in my case those activities could have and
have a hostile effect.

Danilo J Bonsignore
 
A

Alf P. Steinbach /Usenet

* Fabrizio J Bonsignore, on 26.09.2010 03:06:
Oh, that s a typical denial reaction to disregard what is a formal
accusation when I AM living it and... It seems there is a concerted
effort to standardize the language but in contraposition to actual
practice! In opposition to established and successful vendors,
programmers, magazines, applications and even the inventors of the
language!

In a way. That's how politics or any chaotic feedback system works out. The
effects seem rather arbitrary, but generally there's more good than bad,
otherwise nobody would join the process (there's no direct economic incentive).

It was invented in laboratories in Xerox Palo Alto, right?

No, C++ was created at (former) Bell Labs, by Bjarne Stroustrup.

You're thinking of Smalltalk.

I'm sure Smalltalk inspired Bjarne to some degree. Smalltalk was in turn
inspired partly by the Norwegian language Simula, created by Ole-Johan Dahl and
jeez-I-forgot-his-name Nygaard in the late 1960's. The story has it that Alan
Kay picked up a tape that he thought was an Algol compiler, but it turned out to
be a Simula compiler, and hey presto, combine those ideas with a lot of others
floating around, and the Smalltalk project was conceived.

Alan Kay may also lay claim to the idea of the networked tablet computer (via
his PhD thesis, I think it was).

Unless we push that even further back, to Vannevar Bush.

From the same group of people who invented the Windows interface that
was supposedly **snatched** from them by Mac then **stolen** by Gates
for Windows when IBM **lost** the PC patent when everybody was
**learning** programming?

No, Apple was just one of many companies who were invited to implement Smalltalk
and the general ideas (those companies did not include Microsoft, but e.g. HP
and Tektronix, as I recall). Apple did it with the Apple Lisa, which the first
Mac was but a shallow, cheap imitation of. There were some fun absurd
experiments: as I recall Tektronix attempted to implement the Smalltalk GUI on a
vector terminal, but, incredibly, it turned out to be too slow! :)

There was lots of stuff originating at Xerox Parc at that time, the 1970's.

Not only windowing GUIs, not only OO languages and systems like Smalltalk, but
also e.g. the idea of local area networks (they created the Ethernet) and
workstations (like the Alto), things like bitmapped fonts and things like
"blitters" (now known as graphics accelerators); Niklaus Wirth, the creator of
Pascal, visiting, was so impressed that he flew back to Switzerland and started
work on Lilith, a workstation with hardware designed to support his language
Oberon (based on his Modula-2), instead of the usual other way around, designing
languages to fit the constraints of the hardware.

The aim of the Smalltalk project was "a vision of the ways different people
might effectively and joyfully use computing power".

Later work at ParkPlace wasn't quite so groundbreaking, and the later work
seemed to me to be more in the corporate spirit than the personal freedom
spirit, e.g. they worked on intelligent networked whiteboards and electronic id
tags -- yes there's lots of functionality enabled by that, but they didn't
stress privacy/freedom at all, as I understood it, instead, the opposite.

(The Windows interface was not standardized!)

Oh, it was, at the end. In 1995 Microsoft standardized the Win16 API, via ECMA.
Now, could that have /anything/ to do with Windows 95 using the Win32 API? :)

Is the language also being standardized as opposition
to its original designers from those laboratories in the seventies?

Sorry, parse error.

I
havent seen the document, I expect it to have a EBNF grammar and even
a formal mathematics series of proofs, but I ve read enough about its
clauses that I wonder...

The current draft standard is freely available in PDF format from the committee
pages. Type "C++ committee" in the Firefox address bar and you'll get there.


[snip]

Cheers & hth.,

- Alf
 
J

Joshua Maurice

Oh, that s a typical denial reaction to disregard what is a formal
accusation when I AM living it and... It seems there is a concerted
effort to standardize the language but in contraposition to actual
practice! In opposition to established and successful vendors,
programmers, magazines, applications and even the inventors of the
language!
contraposition
That word does not mean what you think it means.

Also, the common practice for a long long time everywhere has been
that (regular lvalue) references do not bind to rvalues, such as
temporaries. You can continue claiming the opposite without any
evidence, and you will continue to be wrong.
 
F

Fabrizio J Bonsignore

Also, the common practice for a long long time everywhere has been
that (regular lvalue) references do not bind to rvalues, such as
temporaries. You can continue claiming the opposite without any
evidence, and you will continue to be wrong.

Anyway,

int specialvarname = 0;

with and without the static keyword produces values from 16xxx up
unless I also make:

int main(void) {
specialvarname = 0;// <--- necessary!!!
++specialvarname; //counts from 16xxx ...
return specialvarname;
}

And THAT is totally against my experience, but I refuse to try to
explain it because ++specialvarname; was only meant to discover... I
cannot output the initial default constructor calls! Because of the -
felide-constructors most likely... but now I have some sequences to
see if... or is it the file cache that places them seemingly at the
end of a sequence? And all the default constructors for some static
and non static arrays? Some are in a template, I admit, but I do
expect them to be called despite elision because they are not in an
assignment statement... but to be _sure_ I do have to make some more
controlled changes and variants.

Danilo J Bonsignore
 
V

Vladimir Jovic

Fabrizio said:
though
economics tell me that the GNU g++ has to be of lesser quality because
it is free. To sacrifice working code for a bad ideal definition is
bad practice.
Not all things in this world which are worthwhile cost money. Perhaps
there is a correlation between money cost and value, but your blanket
claim without allowance for exceptions is incorrect. [/end off-topic
economics rant]- Hide quoted text -

So... can I have my own compiler version without the issue (with the
industry standard hack), tomorrow before noon, please? The argument is
hard and not easy. But it is better than the ad bacculum fallacy: it
is the ISO standard and you take it takes you. I would appreciate some
indication as to how to file a defect report, because this almost
amount to a report!

Here you are :
http://gcc.gnu.org/bugzilla/

Please post the link to your bug report. I am always for a good laugh :)
 
J

James Kanze

On Sep 24, 11:26 am, Fabrizio J Bonsignore <[email protected]> wrote:

[...]
The earlier versions of MSVC which accepted this hack were not
industry standards.

First, it's not a hack; it's just an outdated specification.
The compiler which compiled code with the hack was
not an industry standard. Microsoft is notorious for providing
extensions and such to achieve vendor lock-in. You were coding to a
hack, an extension to the industry standard, an extension to the
official ANSI ISO C++ standard, and an extension to the de facto
standard as widely practiced then and now.

And extension to the current official C++ standard. An
extension which is conformant with earlier de facto standards of
C++ (up to about 1988).

[...]
Lesser quality than what? I use both VC++ and g++ on an almost
daily basis, and g++ is the better compiler: less bugs, more
options to control just how strict I want to be, etc.

The language specification changed over 20 years ago. I guess
the people at g++ think that that's enough time for people to
have changed their code.
 
J

James Kanze

On Sep 25, 4:55 am, Öö Tiib <[email protected]> wrote:

[...]
Oh, that s a typical denial reaction to disregard what is a formal
accusation when I AM living it and... It seems there is a concerted
effort to standardize the language but in contraposition to actual
practice!

That can be said for some things (e.g. the names of the
headers). In this case, however, the rule is definitely
pre-standard, and was existing practice when the standard was
being written.
In opposition to established and successful vendors,
programmers, magazines, applications and even the inventors of the
language!

It was the inventor of the language (Bjarne Stroustrup) who made
the change. And you seem to be the only programmer who doesn't
know about it.
It was invented in laboratories in Xerox Palo Alto, right?

No. C++ was created by Bjarne Stroustrup when he was working at
Bell Telephone Labs.
From the same group of people who invented the Windows
interface that was supposedly **snatched** from them by Mac
then **stolen** by Gates for Windows when IBM **lost** the PC
patent when everybody was **learning** programming?

The basic Windowing interface first showed up on the Xerox Star,
I think. That was from Xerox Palo Alto. The first commercially
successful systems were from Sun and Apollo (later bought by
HP).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top