473,324 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

constructor

i have the following

class sequence {
public:
sequence (const sequence& mysequence, const int newjob) {
job_sequence(mysequence.job_sequence)
job_sequence.push_back(newjob);
...
}

vector<int> job_sequence;
}

what i want is: if i have a sequence object, i want to be able to create a
new object that copies the job_sequence within it and adds another job to
the job_sequence vector.

question: i assume that when i call the constructor for sequence-class, that
first of all the constructor for "vector<int> job_sequence" will be called
( is this wrong? i assume that when i construct an object, the constructors
of all data-members will be called). next: is it ok to call
"job_sequence(mysequence.job_sequence)" in the constructor of sequence?
this last statement says that the constructor of vector<int> should be
called, right? can i call the constructor with the other vector as an
argument, even though the vector object was already constructed (with
default constructor, which i assume, is an empty vector?

tx

Jul 22 '05 #1
24 3687
slurper wrote:
i have the following

class sequence {
public:
sequence (const sequence& mysequence, const int newjob) {
job_sequence(mysequence.job_sequence)
job_sequence.push_back(newjob);
...
}

vector<int> job_sequence;
}
;
what i want is: if i have a sequence object, i want to be able to create a
new object that copies the job_sequence within it and adds another job to
the job_sequence vector.

question: i assume that when i call the constructor for sequence-class,
that first of all the constructor for "vector<int> job_sequence" will be
called ( is this wrong? i assume that when i construct an object, the
constructors of all data-members will be called).
That's correct.
next: is it ok to call "job_sequence(mysequence.job_sequence)" in the
constructor of sequence?
No.
this last statement says that the constructor of vector<int> should be
called, right?
No, it says that the class's operator() gets called. It doesn't have
anything to do with construction. Since AFAIK vector doesn't have
operator() defined, this should produce an error.
can i call the constructor with the other vector as an
argument, even though the vector object was already constructed (with
default constructor, which i assume, is an empty vector?


You cannot call constructors yourself. They are automatically called
whenever you create an object. What you can do is - for member variables -
specify which constructor gets called through the initializer list. If you
don't specify any, the default constructor gets called. So in your above
example, job_sequence will already be default-constructed before you enter
your sequence constructor.
Since you want the copy constructor instead, you'd have to write:

sequence (const sequence& mysequence, const int newjob)
: job_sequence(mysequence.job_sequence)
{
job_sequence.push_back(newjob);
...
}

Jul 22 '05 #2
slurper wrote:
i have the following

class sequence {
public:
sequence (const sequence& mysequence, const int newjob) {
job_sequence(mysequence.job_sequence)
job_sequence.push_back(newjob);
...
}

vector<int> job_sequence;
}
Firts of all:
Constructors are called when you -construct- an object, therefore the name
constructor. It's job is to set the object to an initial state.
Constructors are called implicitly, you shouldn't call them explicitly.
They shouldn't be misued as a means of changing the state of your object.
And maybe even can't, I'm not even sure if an explicit ctor call is legal
in standard C++.

Class names should always start with a capital letter by the way. And you're
missing a semicolon after the ctor call.
question: i assume that when i call the constructor for sequence-class,
that first of all the constructor for "vector<int> job_sequence" will be
called ( is this wrong? i assume that when i construct an object, the
constructors of all data-members will be called).
As far as I know, the order of constructor calls is undefined. Or at least
compiler dependent. But of course vector's ctor will be called before
sequence. Everything else wouldn't make sense.
next: is it ok to call
"job_sequence(mysequence.job_sequence)" in the constructor of sequence?
No, use the init list.
this last statement says that the constructor of vector<int> should be
called, right?


No, you're just saying that sequence has a vector of int. Of course, at some
time of construction, its ctor will be called.

Regards,
Matthias
Jul 22 '05 #3
* Matthias:

As far as I know, the order of constructor calls is undefined. Or at least
compiler dependent.


No, it's generally well-defined.

For member variables it's the order of declaration.

I'm not quite sure with regard to multiple inheritance, but probably
even then (if or when it matters I'll look it up).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #4
Alf P. Steinbach wrote:
* Matthias:

As far as I know, the order of constructor calls is undefined. Or at
least compiler dependent.


No, it's generally well-defined.

For member variables it's the order of declaration.

I'm not quite sure with regard to multiple inheritance, but probably
even then (if or when it matters I'll look it up).


Oh, well, one less problem to worry about :)
You're right of course. This can be pretty confusing at times, because
regardless in which order we write objects in the init list, they will
always be constructed in the order of declaration.

Maybe I confused that with the construction of global objects? I think
that's when the order of construction is undefined (again, feel free to
correct me if I'm wrong).

Best regards,
Matthias
Jul 22 '05 #5

"Matthias Käppler" <no****@digitalraid.com> skrev i en meddelelse
news:cn*************@news.t-online.com...
slurper wrote:
i have the following

class sequence {
public:
sequence (const sequence& mysequence, const int newjob) {
job_sequence(mysequence.job_sequence)
job_sequence.push_back(newjob);
...
}

vector<int> job_sequence;
}
Firts of all:
Constructors are called when you -construct- an object, therefore the name
constructor. It's job is to set the object to an initial state.
Constructors are called implicitly, you shouldn't call them explicitly.
They shouldn't be misued as a means of changing the state of your object.
And maybe even can't, I'm not even sure if an explicit ctor call is legal
in standard C++.

It is - but only rarely needed, and not something a novice should attempt to
do.

Class names should always start with a capital letter by the way. And
you're
missing a semicolon after the ctor call.
Well - there's no constructor call. And theres no need that class names
should start with a capital letter - imo, this is ugly.

[snip]
Regards,
Matthias


Kind regards
Peter
Jul 22 '05 #6
Peter Koch Larsen wrote:
And theres no need that class names
should start with a capital letter - imo, this is ugly.


It's not enforced by the compiler, no. I know the standard library does not
follow this notation, but in all object oriented languages I have seen so
far it is common practice to note classes with the first letter being
uppercase (which would be Java, C# and Ada to name a few, and the major
part of C++ programmers do so as well).

Jul 22 '05 #7

"Matthias Käppler" <no****@digitalraid.com> wrote in message
news:cn*************@news.t-online.com...
Peter Koch Larsen wrote:
And theres no need that class names
should start with a capital letter - imo, this is ugly.


It's not enforced by the compiler, no. I know the standard library does
not
follow this notation, but in all object oriented languages I have seen so
far it is common practice to note classes with the first letter being
uppercase (which would be Java, C# and Ada to name a few, and the major
part of C++ programmers do so as well).


Really? For example, the string class? Or the std template classes, such
as vector, list and map? :-)

-Howard

Jul 22 '05 #8
Howard wrote:

"Matthias Käppler" <no****@digitalraid.com> wrote in message
news:cn*************@news.t-online.com...
Peter Koch Larsen wrote:
And theres no need that class names
should start with a capital letter - imo, this is ugly.


It's not enforced by the compiler, no. I know the standard library does
not
follow this notation, but in all object oriented languages I have seen so
far it is common practice to note classes with the first letter being
uppercase (which would be Java, C# and Ada to name a few, and the major
part of C++ programmers do so as well).


Really? For example, the string class? Or the std template classes, such
as vector, list and map? :-)

-Howard


Yep, I already said the standard template library does not follow this
convention. Only god knows why. And the developers. If this is good or bad
is in the eye of the beholder :)

Cheers,
Matthias
Jul 22 '05 #9

"Matthias Käppler" <no****@digitalraid.com> wrote in message
news:cn*************@news.t-online.com...
Howard wrote:

"Matthias Kdppler" <no****@digitalraid.com> wrote in message
news:cn*************@news.t-online.com...
Peter Koch Larsen wrote:

And theres no need that class names
should start with a capital letter - imo, this is ugly.

It's not enforced by the compiler, no. I know the standard library does
not
follow this notation, but in all object oriented languages I have seen
so
far it is common practice to note classes with the first letter being
uppercase (which would be Java, C# and Ada to name a few, and the major
part of C++ programmers do so as well).


Really? For example, the string class? Or the std template classes,
such
as vector, list and map? :-)

-Howard


Yep, I already said the standard template library does not follow this
convention. Only god knows why. And the developers. If this is good or bad
is in the eye of the beholder :)

Ok...I must be blind! Not enough coffee. Or too much? Sorry. I'll slink
away now.
-Howard

Jul 22 '05 #10
>> And maybe even can't, I'm not even sure if an explicit ctor call is legal
in standard C++.
It is - but only rarely needed, and not something a novice should attempt to

do.

1: What is the syntax of an explicit ctor call?

2: Under what circumstance would such a call be appropriate?

3: Under what circumstances would it be safe to use such a call?

I have seen people attempt to use placement new within one constructor to
employ reuse of another constructor. Is that what you are referring to?


Jul 22 '05 #11
* DaKoadMunky:
And maybe even can't, I'm not even sure if an explicit ctor call is legal
in standard C++.
It is - but only rarely needed, and not something a novice should attempt to

do.

1: What is the syntax of an explicit ctor call?


Several.

Terminology: "explicit" is something you specify directly, "implicit" is
something not directly specified (although I'm reasonably sure that's
not the meaning intended by Peter Koch Larsen here).

Adopting this usual set of meanings you have

string s; // Implicit constructor call.
string t( "x" ); // Explicit constructor call.

so "explicit" is not terribly useful, except perhaps to discuss the
syntactical problems with explicit calls of nullary constructors...

The syntax on the right side in

string u = string( "y" );

is technically a functional cast, IIRC; for the other forms please look
it up yourself (it's spread all over the standard, much work to find).

A more useful distinction is _source code_ level constructor call
(includes both examples above) versus _generated_ constructor call.

An explicit constructor call is always a source code level call, a
generated call is always an implicit one, and there are calls that are
source code level implicit calls, such as the first example above.

Every tree of constructor calls start with a source code level
constructor call, it's just a very common misconception that they're
never "explicit", or not "calls" (that last misconception is mentioned
in the FAQ, by ref to the definition of default constructor). The first
misconception probably stems from a passage in the standard where the
word "explicit" is used for disambiguation in a particular context, and
the last misconception probably stems from the desire to teach newbies
not to think of a constructor as a an ordinary callable member function,
but doing that by inventing a simple and incorrect explanation instead
of how things actually work.

What you can't do is to have a source code level constructor call on
pre-existing storage, except by using placement new (and except to the
degree that one might argue that a base class constructor argument
specification in an initializer list is such a call), and that's the
main purpose of a constructor: to strongly couple allocation with
initialization, at the source code level.

Generated constructor calls are, on the other hand, always made on
pre-existing storage.

Every successful source code level constructor call results in at least
one generated constructor call: to be precise, if your source code level
call is not placement new, but e.g. 'std::string s( "a" );', then it
results in an allocation (static, stack or heap) plus a tree of
generated constructor calls on that allocated storage.

Presumably Peter Koch Larsen is referring to placement new, just using
an unfortunate choice of terms.

2: Under what circumstance would such a call be appropriate?
Placement new is almost never appropriate, certainly not by novices, but
you can find it used in e.g. any implementation of std::vector --
instead of using placement new directly, use for example std::vector.

3: Under what circumstances would it be safe to use such a call?
I'm tempted to write "never", but: when you have full control... ;-)

I have seen people attempt to use placement new within one constructor to
employ reuse of another constructor.


That is extremely dangerous and totally unnecessary. Instead, factor
out the common initialization in a separate function. That's a FAQ.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #12
"DaKoadMunky" <da*********@aol.com> wrote...
And maybe even can't, I'm not even sure if an explicit ctor call is
legal
in standard C++.
It is - but only rarely needed, and not something a novice should attempt
to

do.

1: What is the syntax of an explicit ctor call?


No such thing.
2: Under what circumstance would such a call be appropriate?
Had there been such a call possible, we might consider talking about
appropriateness. Since there is no such thing, why bother?
3: Under what circumstances would it be safe to use such a call?
Under what circumstances would it be safe to travel at the speed of
light?
I have seen people attempt to use placement new within one constructor to
employ reuse of another constructor. Is that what you are referring to?


Probably. It's still not "an explicit ctor call".

V
Jul 22 '05 #13
"Alf P. Steinbach" <al***@start.no> wrote...
[...]
Every tree of constructor calls start with a source code level
constructor call, it's just a very common misconception that they're
never "explicit", or not "calls" (that last misconception is mentioned
in the FAQ, by ref to the definition of default constructor). The first
misconception probably stems from a passage in the standard where the
word "explicit" is used for disambiguation in a particular context, and
the last misconception probably stems from the desire to teach newbies
not to think of a constructor as a an ordinary callable member function,
but doing that by inventing a simple and incorrect explanation instead
of how things actually work.


12.1/2 "Because the constructors do not have names, they are never found
during name lookup". Yes, you can _cause_ a constructor to be called.
You can never _call_ one, though. Where's the misconception? And how is
that "from the desire to teach newbies"? Is the Standard for newbies
only?

V
Jul 22 '05 #14
* Victor Bazarov:
"Alf P. Steinbach" <al***@start.no> wrote...
[...]
Every tree of constructor calls start with a source code level
constructor call, it's just a very common misconception that they're
never "explicit", or not "calls" (that last misconception is mentioned
in the FAQ, by ref to the definition of default constructor). The first
misconception probably stems from a passage in the standard where the
word "explicit" is used for disambiguation in a particular context, and
the last misconception probably stems from the desire to teach newbies
not to think of a constructor as a an ordinary callable member function,
but doing that by inventing a simple and incorrect explanation instead
of how things actually work.
12.1/2 "Because the constructors do not have names, they are never found
during name lookup". Yes, you can _cause_ a constructor to be called.


That's correct.

You can never _call_ one, though.
That's incorrect.

I seem to recall we have discussed that before, and so I simply direct
you again to the same place (definition of default constructor), "can be
called".

Where's the misconception?


In your mind... ;-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #15
"Alf P. Steinbach" <al***@start.no> wrote...
* Victor Bazarov:
"Alf P. Steinbach" <al***@start.no> wrote...
> [...]
> Every tree of constructor calls start with a source code level
> constructor call, it's just a very common misconception that they're
> never "explicit", or not "calls" (that last misconception is mentioned
> in the FAQ, by ref to the definition of default constructor). The
> first
> misconception probably stems from a passage in the standard where the
> word "explicit" is used for disambiguation in a particular context, and
> the last misconception probably stems from the desire to teach newbies
> not to think of a constructor as a an ordinary callable member
> function,
> but doing that by inventing a simple and incorrect explanation instead
> of how things actually work.


12.1/2 "Because the constructors do not have names, they are never found
during name lookup". Yes, you can _cause_ a constructor to be called.


That's correct.

You can never _call_ one, though.


That's incorrect.

I seem to recall we have discussed that before, and so I simply direct
you again to the same place (definition of default constructor), "can be
called".

Where's the misconception?


In your mind... ;-)


Do we always get hung up on the definition of "be"?

Can it be called? Of course it can, it's a function, the compiler makes
sure that a constructor is called when you create an object.

Can I call it? No, of course not. It's a special function that does not
have a name, you cannot call it directly.

So, Alf, when somebody asks the question "can a constructor be called?", do
you see it as "can a constructor be called at all?" or as "can a constructor
be called _by_ me _directly_ using some tricky syntax?", and which question
are you answering? Are you sure you're answering the question asked?

Whose misconception is it?

V
Jul 22 '05 #16
* Victor Bazarov:
"Alf P. Steinbach" <al***@start.no> wrote...
* Victor Bazarov:
"Alf P. Steinbach" <al***@start.no> wrote...
> [...]
> Every tree of constructor calls start with a source code level
> constructor call, it's just a very common misconception that they're
> never "explicit", or not "calls" (that last misconception is mentioned
> in the FAQ, by ref to the definition of default constructor). The
> first
> misconception probably stems from a passage in the standard where the
> word "explicit" is used for disambiguation in a particular context, and
> the last misconception probably stems from the desire to teach newbies
> not to think of a constructor as a an ordinary callable member
> function,
> but doing that by inventing a simple and incorrect explanation instead
> of how things actually work.

12.1/2 "Because the constructors do not have names, they are never found
during name lookup". Yes, you can _cause_ a constructor to be called.
That's correct.

You can never _call_ one, though.


That's incorrect.

I seem to recall we have discussed that before, and so I simply direct
you again to the same place (definition of default constructor), "can be
called".

Where's the misconception?


In your mind... ;-)


Do we always get hung up on the definition of "be"?

Can it be called? Of course it can, it's a function, the compiler makes
sure that a constructor is called when you create an object.


AFAICS that's correct assuming by "object" you mean "object of class
type", for any reasonable definition of "create".

Can I call it? No, of course not. It's a special function that does not
have a name, you cannot call it directly.


That's incorrect.

But I shouldn't just have referred you to the standard, which for once
is pretty explicit.

One logical fallacy is to assume, in spite of repeated clear
explanations that it is not so, that "call" in this context always means
"ordinary source code level function call used to call a constructor on
pre-existing storage"; starting from a such a false premise any
consequence can be derived.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #17
"Alf P. Steinbach" <al***@start.no> wrote...
Can I call it? No, of course not. It's a special function that does not
have a name, you cannot call it directly.
That's incorrect.


Huh?
But I shouldn't just have referred you to the standard, which for once
is pretty explicit.
Do please. I am curious where in the Standard there is evidence to your
"That's incorrect" response. Don't be shy. Give it to me as it is.
One logical fallacy is to assume, in spite of repeated clear
explanations that it is not so, that "call" in this context always means
"ordinary source code level function call used to call a constructor on
pre-existing storage"; starting from a such a false premise any
consequence can be derived.


So, it does not necessarily mean "ordinary source code level function
call", I get it. So, by answering "yes" to "can I call a constructor" you
provide a newbie with a clear explanation of what's going on and no real
confusion can arise, right?

What's the point of this? The entire C++ camp is divided into two apparent
crowds; one (bigger) that says "no" and gives the explanation from the
Standard and the other (including you) that says "yes" _insisting_ that
there is some context to the inquirer's question.

Yes, we "call" constructors every day, often millions of times. The same
way we rotate the Earth by driving our cars from the East to the West. Can
you explain that to somebody without solid understanding of how gravity and
inertia work?

I always assume the _simplest_ "context" in such question. And many of us
started that way too. I write a function. It is called "a constructor".
So what? It's a function. I want to call it. How do I do that? What's
the syntax? The biggest problem is that after telling them that the syntax

{classname} ( {arguments} )

is a call to a constructor (which it isn't, although it eventually does
lead to it), we get "I call another constructor from within my first, why
doesn't it work" kind of questions.

V
Jul 22 '05 #18
Alf P. Steinbach wrote:
* Rolf Magnus:
* Alf P. Steinbach:
> The passage I referred to refers to a source-code level call, and is
> meaningless under any other interpretation: "can be called without an
> argument" only makes sense at the source code level. If you think there
> is any other reasonable interpretation do supply it.
Well, the arguments you specify when you create an object are forwareded
to the constructor.


A = "can be called without an argument" means, according to you,

B = "the arguments you specify when you create an object are
forwareded to the constructor"


No, and I didn't claim so.
Please explain how statement A really means B,
A doesn't mean B. B just explains how A can be true even though you can't
call a constructor yourself.
If you specify arguments on creation of an object, those argments are
forwarded to the constructor. If you don't, well - there isn't anything to
forward, so the default constructor gets called.
and how statement B is a good definition of a default constructor.
It isn't.
Then we can go back up the digression stack and you can then explain
what "called" means in statement A (the standard's wording).


If the program stops execution of whatever it was doing, jumps to the
beginning of the constructor's body, executes it, then jumps back and
continues what it was doing before, then I'd say that the constructor was
"called".

Jul 22 '05 #19
* Rolf Magnus:
Alf P. Steinbach wrote:
* Rolf Magnus:
* Alf P. Steinbach:

> The passage I referred to refers to a source-code level call, and is
> meaningless under any other interpretation: "can be called without an
> argument" only makes sense at the source code level. If you think there
> is any other reasonable interpretation do supply it.

Well, the arguments you specify when you create an object are forwareded
to the constructor.


A = "can be called without an argument" means, according to you,

B = "the arguments you specify when you create an object are
forwareded to the constructor"


No, and I didn't claim so.
Please explain how statement A really means B,


A doesn't mean B. B just explains how A can be true even though you can't
call a constructor yourself.
If you specify arguments on creation of an object, those argments are
forwarded to the constructor. If you don't, well - there isn't anything to
forward, so the default constructor gets called.
and how statement B is a good definition of a default constructor.


It isn't.
Then we can go back up the digression stack and you can then explain
what "called" means in statement A (the standard's wording).


If the program stops execution of whatever it was doing, jumps to the
beginning of the constructor's body, executes it, then jumps back and
continues what it was doing before, then I'd say that the constructor was
"called".


Your interpretation of §12.1/5 is then that a default constructor is one
that isn't forwarded any arguments.

That is incorrect.

A default constructor is, quoting the standard, one that "can be called
without an argument"; it can have any number of defaulted formal
arguments (which are forwarded to it).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #20
Alf P. Steinbach wrote:
Your interpretation of §12.1/5 is then that a default constructor is one
that isn't forwarded any arguments.
Not exactly. Because you didn't specify any arguments, there are none to
forward to the constructor. Therefore, only a constructor may be used that
can be called without an argument.
That is incorrect.
It's not exactly what I said.
A default constructor is, quoting the standard, one that "can be called
without an argument";


Note that I inserted exactly that into my explanation above.

Jul 22 '05 #21
Rolf Magnus wrote:

Alf P. Steinbach wrote:
Your interpretation of §12.1/5 is then that a default constructor is one
that isn't forwarded any arguments.


Not exactly. Because you didn't specify any arguments, there are none to
forward to the constructor. Therefore, only a constructor may be used that
can be called without an argument.
That is incorrect.


It's not exactly what I said.
A default constructor is, quoting the standard, one that "can be called
without an argument";


Note that I inserted exactly that into my explanation above.

Ralf, give up.
Many of the regulars had this discussion with Alf a number of times.
He doesn't understand or he will not understand, that this section of
the standard isn't phrased very well. From the rest of the standards
document however it is very clear what is ment, at least for most of
us.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #22
* Rolf Magnus:
Alf P. Steinbach wrote:
Your interpretation of §12.1/5 is then that a default constructor is one
that isn't forwarded any arguments.
Not exactly. Because you didn't specify any arguments, there are none to
forward to the constructor.


I note in passing that here you interpreted "called without an argument"
as "you didn't specify any arguments", i.e. "called" = source code call.

Which is correct, but the conclusion after the comma is incorrect.

A default constructor can have any number of defaulted formal arguments,
and those will be forwarded to it.

Therefore, only a constructor may be used that
can be called without an argument.


Do you mean

a) only a constructor that can be called at the source code level
without an argument (correct interpretation),
or

b) only a constructor that can be called at the generated call
level without an argument (if it has formal arguments then in any
reasonable C++ implementation it can't be called at that level
without arguments, or otherwise it means a default constructor is
defined in terms of a call to an unspecified and unmentioned thunk
mechanism that supplies the actual arguments and also can be used
for _any_ constructor, so that the definition is void)

?

That is incorrect.


It's not exactly what I said.


Glad it wasn't.

A default constructor is, quoting the standard, one that "can be called
without an argument";


Note that I inserted exactly that into my explanation above.


Yes, the question here is whether you can provide a reasonable and clear
interpretation of what "called" means in that statement, one that is
compatible with your other (unsustainable) views; you haven't done so.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #23
* Karl Heinz Buchegger:

Ralf, give up.
Good advice.

Many of the regulars had this discussion with Alf a number of times.
He doesn't understand or he will not understand, that this section of
the standard isn't phrased very well. From the rest of the standards
document however it is very clear what is ment, at least for most of
us.


By "isn't phrased very well" do you mean the standard incorrectly uses
the word "call" about constructor calls?

LOL. :-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #24
* Alf P. Steinbach:
* Karl Heinz Buchegger:

Ralf, give up.


Good advice.

Many of the regulars had this discussion with Alf a number of times.
He doesn't understand or he will not understand, that this section of
the standard isn't phrased very well. From the rest of the standards
document however it is very clear what is ment, at least for most of
us.


By "isn't phrased very well" do you mean the standard incorrectly uses
the word "call" about constructor calls?

LOL. :-)


Uhm, just out of curiosity, please explain what this note means (quoting
the Holy Standard): "explicit constructor calls do not yield lvalues"?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jun | last post by:
I have following script <script> var Animal = function(name){ this.name = name; } Animal.prototype.eat = function (food) {
15
by: A | last post by:
Hi, A default copy constructor is created for you when you don't specify one yourself. In such case, the default copy constructor will simply do a bitwise copy for primitives (including...
23
by: Fabian Müller | last post by:
Hi all, my question is as follows: If have a class X and a class Y derived from X. Constructor of X is X(param1, param2) . Constructor of Y is Y(param1, ..., param4) .
12
by: Marcelo Pinto | last post by:
Hi all, In practice, what is the diference between a default constructor and an explicit default constructor? class Ai { public: Ai() {} };
18
by: Matt | last post by:
I try to compare the default constructor in Java and C++. In C++, a default constructor has one of the two meansings 1) a constructor has ZERO parameter Student() { //etc... } 2) a...
9
by: Player | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all. I am in the process of teaching myself C# and I think I am doing OK. I have learnt how to how to call the right constructor of a...
45
by: Ben Blank | last post by:
I'm writing a family of classes which all inherit most of their methods and code (including constructors) from a single base class. When attempting to instance one of the derived classes using...
8
by: shuisheng | last post by:
Dear All, I am wondering how the default copy constructor of a derived class looks like. Does it look like class B : public A { B(const B& right) : A(right) {}
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
13
by: sam_cit | last post by:
Hi Everyone, I have the following unit to explain the problem that i have, class sample { public : sample() { printf("in sample...\n"); }
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.