Hi Girish,

It will generate an exception on Solaris. It's not Sun Studio fault. I think it's result from the Solaris OS design. You can use preload /usr/lib/[EMAIL PROTECTED] . You have the info at http://docs.sun.com/app/docs/doc/816-5165/6mbb0m9k7?a=view

-bash-3.00# LD_PRELOAD_32= /usr/lib/32/[EMAIL PROTECTED]

-bash-3.00# export LD_PRELOAD_32            **针对32位程序

-bash-3.00# LD_PRELOAD_64= /usr/lib/64/[EMAIL PROTECTED]

-bash-3.00# export LD_PRELOAD_64            **针对64位程序  

Regards,
Adam

girish wrote:
Can someone please explain why this program works in sunstudio C compiler but 
seg faults in gcc:

#include <stdio.h>
#include <string.h>

int
main()
{
        char *ptr = "adam";

        strcpy(ptr, "eve");
        printf("%s\n", ptr);
}
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to