TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: Paul Edwards
date: 1996-01-22 23:36:30
subject: Realloc

FA> But this is where i get ticked off with ISO/ANSI compliance.
FA> I'd be very interested to find out just how many of the leading software 
FA> packages out there(both shareware and commercial) would be ISO.

Anything that does more than TTY input/output is not "strictly
conforming".  It may be "conforming" though.

FA> Large amount of today's software would be written with OOPS, i find it hard 
FA> to believe that anyone would use the alloc family functions when new is 
FA> easier and more efficient, and it does allocate far on demand.

new is C++, not C.

FA> Not to mention that classes use the new function to allocate themselves.
FA> One might say that classes are non ISO anyway..

I am not talking about C++ at all.

FA> I have actually made a decent effort to write portably for any publicly 

Hmmm, I wonder.

FA> posted code, but i would not bother much about portability for my own code,
FA> after all time is money. 
FA> It may be a problem later on if i buy another compiler, but most of the 
FA> stuff 
FA> i finish won't need repair by then, or won't be needed anymore. 

I tend to think that a program not worth porting is a program
not worth writing.  Why would you not want to run your program
on a Unix system?  Or MVS?  Or VAX?  Or Macintosh?

FA> At the same time why bother spending $6-700 for compilers, if one can't use 
FA> half the functions in them just to be compliant ?

Maybe there's a market for a decent C library?

FA> All very well to have a standard, but the standard should be standardized 
FA> more often to follow industry changes. 

The systems I just listed above are all real, popular systems.
I'd like to see what you are proposing that works on all of
those systems.

FA> 
FA> I thought dos was in 64K chunks, so why does ISO say 32K maximum
anyway ?       

Hang on.  malloc() takes size_t, which is 64k on your DOS
system, and 4 gig on my OS/2 system.  ISO says size_t.  To write
a conforming program on my OS/2 compiler, I can do this:

p = malloc(5000000);

To be conforming on my DOS compiler I can do this:

p = malloc(50000);

To be STRICTLY CONFORMING, I can *hope* that this works:

p = malloc(32767);

The latter is my best chance of working, as my program is indeed
strictly conforming, although even that doesn't guarantee 100%
portability to every single system.  However, you are unlikely
to be able to name a platform which boasts a 100% ISO conforming
C compiler that doesn't accept that last statement.

BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.