Yes, using PChar, or any pointer type, is dangerous.  Using classes is also
dangerous - classes are really just pointers, and can point to nothing, you
can free them twice, and generally cause all sorts of trouble for yourself.

To take your argument to its logical conclusion, would you advocate not
using classes because records never show errors and "work, plain and
simple"?

Cheers,
Carl

-----Original Message-----
From: Jason L. Coley [mailto:[EMAIL PROTECTED]]
Sent: Monday, 9 October 2000 11:25 AM
To: Multiple recipients of list delphi
Subject: RE: RE: [DUG]: Creating PChars


In my experiance, using PChars is pretty dangerous, as a lot of systems
will show errors, and usually GetMem and FreeMem are the culprits. I
don't know the exact reason why, or what combinations of systems,
operating systems and API calls are the bad apples, but we have
thousands of users worldwide, and we just don't use Pchars at all.. its
not worth the hassle. We have gone to using array of Char, as long as
you know how many bytes to use. In fact some of my arrays are 6-7 k in
size, but the extra memory overhead is a lot better than the hassle of
whether it will work or not. With arrays it works, plain and simple.

Regards
Jason Coley
Manawatu Software Solutions
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to