Re: C portability is a myth

From: infobahn (infobahn_at_btinternet.com)
Date: 02/26/05


Date: Sat, 26 Feb 2005 06:37:59 +0000 (UTC)

Allin Cottrell wrote:
>
> Keith Thompson wrote:
> > Mark McIntyre <markmcintyre@spamcop.net> writes:
>
> >>>Dammit, I showed that it was plain _wrong_. Is that not
> >>>enough?
> >>
> >>In what way is the information that malloc is ANSI compatible wrong? Please
> >>explain.
> >
> > I think it's about the mention of the <malloc.h> header.
>
> It is indeed. The implication of the MSDN page is that <malloc.h>
> is a standard C header. I have not found such misinformation in
> *nix man pages for functions such as malloc().

man system

DESCRIPTION

system() executes a command specified in string by calling /bin/sh -c
string, and returns after the command has been completed. During exe-
cution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT
will be ignored.

RETURN VALUE

The value returned is -1 on error (e.g. fork failed), and the return
status of the command otherwise. This latter return status is in the
format specified in wait(2). Thus, the exit code of the command will
be WEXITSTATUS(status). In case /bin/sh could not be executed, the
exit status will be that of a command that does exit(127).

CONFORMING TO
ANSI C, POSIX.2, BSD 4.3
(etc)

The implication of the man page is that /bin/sh -c, SIGCHLD, SIGQUIT,
wait, WEXITSTATUS, and the semantics of the return status, are all
defined by ANSI.

Neither MSDN nor man pages define C. They can, however, be used as
a quick reference by those who have a firm grasp of the language
already. I can read the above descriptions of malloc and system,
and get what I need from them (in the unlikely event that I might
have forgotten), without being confused by what you call misinform-
ation. So can you, I'm sure.

Those who can't should be learning C from a good C book, not from
man pages or MSDN.



Relevant Pages

  • Re: configuring FTP Server in wince device.
    ... It's all in the registry settings - the MSDN page covers it. ... From the command line on thedevicerun the following: ... dragging the catalog item and i am sure that ftpd.dll is included in ...
    (microsoft.public.windowsce.embedded)
  • Re: MSFlexGrid - column widths
    ... Thomas Bernacki wrote: ... I did in fact go to the MSDN page first... ... Matlab though when I run that command it tells me: ...
    (comp.soft-sys.matlab)
  • Re: Command line compilation of visual studio project files.
    ... Microsoft support line - MSDN has nothing to do with it. ... As far as I know Microsoft is obliged to answer in 3 days to MSDN ... /rebuild and /clean command line parameters to devenv. ... Search for devenv in the VS help index and you'll see an entry discussing ...
    (microsoft.public.vstudio.development)
  • Re: Newbie Question
    ... This is not the normal purpose, so have a look at AdoNet on MSDN. ... The only thing not written here was I thought how to set a connection ... This is for SQL server that is SQLclient.SQLxxxxx for Access or other it can ... i have a form with two text boxes and a command button. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to set exit code of non-console app?
    ... NOT yet returned an exit code to Windows (even though it has returned ... control to the command prompt, ... behavior does NOT occur if executing within a command script."). ...
    (microsoft.public.dotnet.languages.csharp)