Re: vulnerabilities
From: Dan Pop (Dan.Pop_at_cern.ch)
Date: 10/22/04
- Next message: CBFalconer: "Re: GetByte(int x, int n)"
- Previous message: Phlip: "Re: Compiling a tar.gz source file in Windows"
- In reply to: jacob navia: "Re: vulnerabilities"
- Next in thread: Keith Thompson: "Re: vulnerabilities"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Oct 2004 19:33:37 GMT
In <41794e86$0$1007$8fcfb975@news.wanadoo.fr> jacob navia <jacob@jacob.remcomp.fr> writes:
>I do not pretend that my first example compiles. The second does
>however: here it is again:
Even if it compiles, this doesn't make it legal.
>#include <stdio.h>
>void memset(char * p,int s,int b)
>{
> while (b--)
> *p++ = s;
>}
Being in a different namespace, I guess C++ allows using the memset
function name like this, but I could be wrong.
>void main(void)
>From the C++ standard:
2 An implementation shall not predefine the main function. This func-
tion shall not be overloaded. It shall have a return type of type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
int, but otherwise its type is implementation-defined.
^^^
>{
> char p[2];
>
> memset(p,0,123546);
> printf("not reached :-)\n");
>}
>
>Will you pretend that this is not legal C++?
g++ certainly does:
fangorn:~/tmp 88> cat test.c
void main(void) { }
fangorn:~/tmp 89> g++ test.c
test.c:1: error: `main' must return `int'
>It compiles perfectly and crashes as it should.
If your C++ compiler doesn't even warn about it, ask for a refund.
Note that a "shall" requires a diagnostic when violated, in the C++
standard (unless the standard explicitly says otherwise).
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
Currently looking for a job in the European Union
- Next message: CBFalconer: "Re: GetByte(int x, int n)"
- Previous message: Phlip: "Re: Compiling a tar.gz source file in Windows"
- In reply to: jacob navia: "Re: vulnerabilities"
- Next in thread: Keith Thompson: "Re: vulnerabilities"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|