Article View: borland.public.cppbuilder.nativeapi
Article #3758Re: Basic C++ Question...
From: Alan Bellingham
Date: Fri, 05 May 2006 09:11
Date: Fri, 05 May 2006 09:11
30 lines
2005 bytes
2005 bytes
pnunn <pnunn@infoteq.com.au> wrote: >Bugger, missed that one.. No, its not a derived class at all, its an >array of stateLine elements. Wonder why it compiled at all. Better check your code - it looks like something is seriously confused, then. >> Oh, failure three - how does the code know how many elements in the >> array? > >Ah, I used sizeof(table)/sizeof(*table); 'table' is your pointer - size 4 bytes. Isn't it? >So... what should I be doing? Guess I've got to use new to make the >table and the elements, then pass this pointer. Is that right? How >should I go about this? I'd use a std::vector<>, myself. I really don't trust raw ownership pointers. Sooner or later, you write some code somewhere that forgets to clean up correctly. Or that doesn't handle an exception at a most embarrassing time. Better to use components that always clean themselves up. Oh, and the std::vector<> *knows* its size. Alan Bellingham -- ACCU Conference 2007 - venue to be determined.
Technical Details
Message-ID:
<fe5m521g0ceklr6gkmjqkh31kimqqb9mqi@4ax.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<445a02bf$1@newsgroups.borland.com> <kr2k525hn6ec8f3f8htar80mcd6d9r9d8r@4ax.com> <445ad225@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f15d7bde0eba2566 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Alan Bellingham <alanb@episys.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Basic C++ Question... Date: Fri, 05 May 2006 10:11:55 +0100 Reply-To: alanb@episys.com Message-ID: <fe5m521g0ceklr6gkmjqkh31kimqqb9mqi@4ax.com> References: <445a02bf$1@newsgroups.borland.com> <kr2k525hn6ec8f3f8htar80mcd6d9r9d8r@4ax.com> <445ad225@newsgroups.borland.com> X-Newsreader: Forte Agent 3.3/32.846 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 193.129.251.253 X-Trace: newsgroups.borland.com 1146820315 193.129.251.253 (5 May 2006 02:11:55 -0700) Lines: 30 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail