Hi, Darin Mcbride!
On 22 Jul 97 00:00:37 you wrote to Dan Mcgregor
SS> /* 4. C-style casts are outlawed as of the latest draft proposal */
SS> long bar;
SS> int baz = (long)bar;
DM> Strange. I use type casts all the time. IE:
DM> char *i;
DM> i = (char *) malloc (30 * sizeof (char));
DM> 1. It's no longer permitted. Use the *_cast() functions instead.
Where did you read it's no longer permitted?
DM> 2. malloc is a C-ism. Use new/delete instead.
Yes, mallos is definitely a C-ism, but it still works. While new/delete tend
to have bugs in nearly every compiler. And sometimes in the OS. (I had a
rare, but reproductable bug that manifested in windows using new/del and not
with malloc/free.
So when I need unformatted memory storage, I better use malloc, not new
char[]. (Okay, I don't do that, I have a simple memblk class that does it as
internal work.)
But using a modern C++ compiler malloc will definitely be a problem, as new
will very probably set up with sophisticated new handlet or exception-
throwing. So on such a compiler I'll probably switch back to new[] in that
class.
Paul
... Happiness is a warm boot
--- OS/2 Warp
---------------
* Origin: The FlintStones' Cave in BedRock (2:371/20)
|