Topic: void main - clarification?
Author: fjh@murlibobo.cs.mu.OZ.AU (Fergus Henderson)
Date: 1997/09/27 Raw View
"Jesse Liberty" <jliberty@libertyassociates.com> writes:
>My understanding is that main() must return int.
That is correct.
>However, in section 14 Templates I found this:
>
> void main() {
> A<int>* p;
> p->A<int>::~A(); // ok: destructor call
> p->A<int>::~A<int>(); // ok: destructor call
> }
> --end example]
That's a bug in the draft standard.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: "Jesse Liberty" <jliberty@libertyassociates.com>
Date: 1997/09/27 Raw View
Forgive me if this has come up before.
My understanding is that main() must return int. I quote this from the
draft:
***
3.6.1 Main function [basic.start.main]
1 A program shall contain a global function called main, which is the
designated start of the program. ...
2 An implementation shall not predefine the main function. This function
shall not be overloaded. It shall have a return type of type int, but
otherwise its type is implementation-defined. All implementations shall
allow both of the following definitions of main:
int main() { /* ... */ }
and
int main(int argc, char* argv[]) { /* ... */ }
****
However, in section 14 Templates I found this:
***
void main() {
A<int>* p;
p->A<int>::~A(); // ok: destructor call
p->A<int>::~A<int>(); // ok: destructor call
}
--end example]
***
Can you clarify? Thanks.
-j
--
Jesse Liberty, President. Liberty Associates, Inc.
http://www.libertyassociates.com
jliberty@libertyassociates.com
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]