🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages Started by a.steenveld Fri, 10 Aug 2007 10:36
problems with stdarg.h
#1474
Author: a.steenveld
Date: Fri, 10 Aug 2007 10:36
73 lines
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. 
Re: problems with stdarg.h
#1475
Author: Alan Bellingham
Date: Fri, 10 Aug 2007 10:58
13 lines
1365 bytes
"a.steenveld" <a.steenveld@id.umcn.nl> wrote:

>I don't know if this is the right place to ask my question, if not please 
>advise me on which group to use.

For once, it looks like it should be in
borland.public.cppbuilder.language.cpp (it's usually the other way round
- posts that should be here pop up there).

Alan Bellingham
-- 
Team Browns
ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads