Operating System - HP-UX
1753524 Members
6156 Online
108795 Solutions
New Discussion юеВ

Re: C Language design: "core dump" and message "bus error"

 
chkv
New Member

C Language design: "core dump" and message "bus error"

I had a cord which HP_UX send error message and core dump, but under AIX and Windows both OK. WHY?

*va_arg(arglist,int*)=atoi(str+idx2);
2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: C Language design: "core dump" and message "bus error"

Shalom,

Perhaps you can provide a little detail on what your expected results are.

It is possible this is generated by bad code, or perhaps the C compiler needs patching and update.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: C Language design: "core dump" and message "bus error"

You didn't mention your OS version and compiler version.

Also, you shouldn't write tricky vararg code like this. You should use it as little as possible and only in simple operations:
int *pint = va_arg(arglist,int*);
*pint = atoi(str+idx2);

I assume you have followed all the rules of using stdarg(5) by doing:
void foo(const char *format, ...) {
    va_list arglist;
    va_start(arglist, format);