Topic: friendly main
Author: assert@my-deja.com
Date: 2000/07/27 Raw View
#include <iostream>
using namespace std;
struct S
{
friend int main () { cout << "boo" << endl; }
};
// well formed ?
additionally, if
int main (int argc, char *argv[]) is legal
then is
int main (int argc, char **argv) legal too ?
(same with int main () and int main (void))
it isnt clear to me if 3.6.1
is talking about the signature of
the function in general or the
functions exact form ?
Thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Gabriel Dos Reis <gdr@merlin.codesourcery.com>
Date: 2000/07/27 Raw View
assert@my-deja.com writes:
| #include <iostream>
|
| using namespace std;
|
| struct S
| {
| friend int main () { cout << "boo" << endl; }
| };
|
| // well formed ?
No.
3.6.1/3:
[...] A program that declares main to be inline or static is ill-formed.
--
Gabriel Dos Reis, gdr@codesourcery.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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]