[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Whats wrong with this program?



Brian May wrote:
> #include <stdio.h>
> #include <string.h>
> 
> int main()
> {
> 	char a[1] = { 'a' };
> 	memset(a,0,sizeof(a));	
> 	printf("%s",strdup("hello"));
> 	return(0);
> }
> 
> generates lots of warnings.
> 
> [541] [dewey:bam] ~/cvswork/heimdal >gcc test.c -o test -O2 -Wpointer-arith -Wall

-O2 does not like -Wpointer-arith, if you leave out either of them
it compiles fine.

Regards,

	Joey

-- 
Beware of bugs in the above code; I have only proved it correct,
not tried it.  -- Donald E. Knuth


Reply to: