🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.migration
Article #73

Re: problem with delphi function which returns array of byte

#73
From: Alisdair Meredith [TeamB]
Date: Thu, 03 Feb 2005 09:14
28 lines
1897 bytes
Rolf Fankhauser wrote:

> My problem is how to access the array of bytes in CBuilder. It
> returns only one byte and not the whole array. Or is this the pointer
> to the array?

Correct, that is how arrays work in C, and so in C++.
In C you would normally pass an extra integer to know how long the
array is.  Obviously that is not necessary for Delphi where the array
type contains more information and is bounds-checked at runtime.

So yes, assume the rest of the array is there and you can access the
elements with the syntax  :
  Key[3] = 5;

and so on.

But now you have 2 choices to make:

i/ Accept the fact you know the array size is fixed, but not
communicated to the software.  Run the risk of the Delphi definition
changing and maybe breaking your program.

ii/ Add an extra integer parameter to the function calls that is
redundant and useless in Delphi, to tell C++ code the size of the array.


AlisdairM(TeamB)
Technical Details
Message-ID: <4201eb82@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4201E87C.3050806@switzerland.org>

Show Full Headers
Complete Article Headers
X-Google-Thread: 110f51,f153cb35baf81ed1
X-Google-Attributes: gid110f51,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Alisdair Meredith [TeamB]" <alisdair.NO.SPAM.PLEASE.meredith@uk.renaultf1.com>
Subject: Re: problem with delphi function which returns array of byte
Newsgroups: borland.public.cppbuilder.migration
References:  <4201E87C.3050806@switzerland.org>
Organization: Renault F1 Team Ltd.
User-Agent: XanaNews/1.16.5.1
NNTP-Posting-Host: 195.153.139.2
Message-ID: <4201eb82@newsgroups.borland.com>
Date: 3 Feb 2005 01:14:42 -0800
X-Trace: newsgroups.borland.com 1107422082 195.153.139.2 (3 Feb 2005 01:14:42 -0800)
Lines: 28
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail