Thread View: comp.std.c++
2 messages
2 total messages
Started by Ron Guilmette
Fri, 14 Dec 1990 02:33
Nit of the day.
Author: Ron Guilmette
Date: Fri, 14 Dec 1990 02:33
Date: Fri, 14 Dec 1990 02:33
19 lines
678 bytes
678 bytes
I'm at it again. Picking nits as usual.
Given:
struct S {
int i;
};
void S (void);
void foobar ()
{
S ();
}
Did I call the explicitly declared function `S' or did I call the
implicitly compiler-created constructor for `struct S'?
References to E&S would be appreciated.
Re: Nit of the day.
Author: Mike Lijewski
Date: Sun, 16 Dec 1990 20:04
Date: Sun, 16 Dec 1990 20:04
36 lines
1728 bytes
1728 bytes
In article <3000@lupine.NCD.COM> rfg@lupine.ncd.com (Ron Guilmette) writes:
>I'm at it again. Picking nits as usual.
>
>Given:
>
> struct S {
> int i;
> };
>
> void S (void);
>
> void foobar ()
> {
> S ();
> }
>
>Did I call the explicitly declared function `S' or did I call the
>implicitly compiler-created constructor for `struct S'?
Good question. On page 27 of E&S is an example very similar to yours.
The answer in that case is the function `S' would be called. If we
then turn to page 167 there is an example of a class X with an explicit
constructor w/ prototype X(int);. If we also have a function void X(int);
the statement X(1); becomes ambiguous. Seems to me we need a much better
explanation of when an implicitely-defined default constructor is
generated and, a bit more explicitely, can I call such a constructor
in a program. I would also like to know why a default
constructor is generated for EVERY class which has no explicitely-
declared constructors (page 264 E&S). Seems to me this contradicts the
example on page 27.
--
Mike Lijewski (H)607/272-0238 (W)607/254-8686
Cornell National Supercomputer Facility
ARPA: lijewski@theory.tn.cornell.edu BITNET: mjlx@cornellf.bitnet
SMAIL: 25 Renwick Heights Road, Ithaca, NY 14850
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads