Article View: borland.public.cppbuilder.nativeapi
Article #1474problems with stdarg.h
From: a.steenveld
Date: Fri, 10 Aug 2007 10:36
Date: Fri, 10 Aug 2007 10:36
73 lines
3250 bytes
3250 bytes
Hi,
I don't know if this is the right place to ask my question, if not please
advise me on which group to use.
The problem which I can't crack has to do with stdarg.h. The code compiles
without complains but it crashes when executed. My best guess is that there
is a problem with the handling of variable number of arguments in in Borland
C++Builder v6.0 but I can't find any reference to such problems (which makes
it more likely that I'm doing something wrong myself). The same code runs
without any problem with the Microsoft VisualC++ v6 compiler.
Does anybody have a suggestion? I'm running out of idea's. :-(
My configurations is as follows:
OS: Windows XP, home edition, Dutch version. (build 2600, service pack 2)
Compiler: C++Builder version 6.0 (build 10.157)
configuration:
compiler: no optimization, all warnings, include debug information, line
number info,
disable expansions, with stack frames, extended error info.
advanced compiler: Pentium Pro code, data alignment quad, calling
convention C,
register variables automatic, fast floating point, ANSI C
I don't think that the other compiler configuration info is meaningfull for
this problem so I skip those for the moment.
Codeguard shows the following results:
CodeGuard error log:
Error 00024. 0x130300 (Thread 0x0B30):
Pointer arithmetic overrun: 0x0012FF48+4, that is at offset 4+4 in local
block
0x0012FF44(=[ebp+0x8] @rcl.exe:0x01:003E83) which is only 4 bytes long.
Call Tree:
0x00404E83(=rcl.exe:0x01:003E83) ...\source\rcl-memory.c#607
0x004048CB(=rcl.exe:0x01:0038CB) ...\source\rcl-memory.c#461
0x00406FBE(=rcl.exe:0x01:005FBE) ...\source\rcl-system.c#251
0x0040477B(=rcl.exe:0x01:00377B) ...\source\rcl-main.c#59
0x3267E552(=CC3260MT.DLL:0x01:07D552)
The bits of code that are involved look like this:
rcl-memory.c
...
typedef long NumberInt;
typedef double NumberFloat;
typedef enum NumberType {integer, floating, corrupt};
typedef struct {
enum NumberType type;
union {
NumberInt i;
NumberFloat f;
} data;
} Number;
...
writen(&accu, integer, 6); /* line #461 */
...
void writen(Number *r, enum NumberType t, ...) {
va_list ap;
va_start (ap, t); /* line #607 */
...
Kind regards,
Andre Steenveld.
Technical Details
Message-ID:
<46bc3f73@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ba88bb643fcefe05,start X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "a.steenveld" <a.steenveld@id.umcn.nl> Newsgroups: borland.public.cppbuilder.nativeapi Subject: problems with stdarg.h Date: Fri, 10 Aug 2007 12:36:58 +0200 Lines: 75 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 NNTP-Posting-Host: 89.98.72.132 Message-ID: <46bc3f73@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1186742131 89.98.72.132 (10 Aug 2007 03:35:31 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail