Missing prototype and resulting coredump in 64 bit machines
- From: Rakesh UV <uvrakesh@xxxxxxxxx>
- Date: Thu, 18 Oct 2007 06:37:56 -0000
Hi,
If i am not putting the function prototype of a function
returning a pointer, i get a core dump.Though this will happen less
probably on 32 bit machine
example
int main(int argc , char **argv)
{
char *base = basename(argv[0]) ;
printf("%s",base);
return 0;
}
The compiler assumes that basename is returning an int and thus we
loose 32 bit of the actual address, because pointer is 64 bit and
integer is 32 bit in 64 bit machines
I am working on
Os linux x86_64 2.6.9
Machine Hp
compiler gcc 3.46
Is there any option in GCC to make the default return value as long so
that i can preserve the actual address returned
Rakesh UV
.
- Follow-Ups:
- Re: Missing prototype and resulting coredump in 64 bit machines
- From: Don Morris
- Re: Missing prototype and resulting coredump in 64 bit machines
- Prev by Date: Re: rx8620 rebooted
- Next by Date: Re: Missing prototype and resulting coredump in 64 bit machines
- Previous by thread: HP-RT: clsters high in rtmon, how to reduce?
- Next by thread: Re: Missing prototype and resulting coredump in 64 bit machines
- Index(es):
Relevant Pages
|
|