delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/18/03:16:16

From: Weiqi Gao <weiqigao AT a DOT crl DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C library fn usability
Date: Fri, 17 Dec 1999 22:39:04 -0600
Organization: CRL Network Services
Lines: 59
Message-ID: <385B0FE8.7DDDB26@a.crl.com>
References: <385795e4 DOT 0 AT news DOT cyberway DOT com DOT sg> <385B34A8 DOT C67 AT marshall DOT edu>
NNTP-Posting-Host: a116005.stl1.as.crl.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i586)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Mark Hathaway wrote:
> 
> Hello all,
> 
> I'm new to this newsgroup and sorta new to C, so I need to be -> pointed
             ^^^^^^^^^^^^^^ you mean, these newsgroups?
> in the right direction for some information.

I've cut down the crossposted newsgroups to this one only.

> In my studying of FAQs and such I keep seeing references to functions
> which are flaky or difficult to use or non-portable or non-standard.
> So, I need some questions answered or to be pointed to the answers.
> 
> Questions:
> 
> 1. Which C library functions is it best to avoid for one reason or
> another?

Depends on your goals.  Avoid functions that will hurt your goals.  If
you are writing Windows applications, avoid fork().  If you are writing
cross-platform applications, avoid GetPrivateProfileString().

> 2. Which C library functions are ANSI/ISO?

K&R II, pp. 241--258.

> 3. Which C library functions are portable?

ANSI/ISO functions, POSIX function, Win32 functions.  Each set is
portable in a specific group of platforms.

> 4. Which are NOT ANSI/ISO or portable, but are still very useful and
> are needed at some times?

WinMain() is pretty indispensible for Win32 applications, although not
in the ANSI/ISO standard.

> 5. Which in gcc (I use DJGPP) use language extensions?

The standard functions are guaranteed to behave in a certain way.  The
fact that their implementation may relies on language extensions should
not matter to the application programmer.

> 6. Which raises the question of what the extensions are that gcc (DJGPP)
> support?

It's best that you don't know them.  Stuff you learn from regular C
books are unlikely compiler extensions.

> I haven't seen the answers to these questions in the FAQs I've read, but
> it would seem very useful to have them answered somewhere online.

Kernighan & Pike's new book, The Practice of Programming, has a whole
chapter on portability.

-- 
Weiqi Gao
weiqigao AT a DOT crl DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019