Safe C library

R

Richard Heathfield

William Ahern said:

I think it's safe to say that Microsoft has basically given the finger
to the C99 specification.

Yes, but let's not forget they have their bad points too.
 
M

Malcolm McLean

William Ahern said:
(In their defense, it's tidier to deal w/ the return type of
snprintf() as an unsigned integral for comparisons with (size_t).)
An example of how size_t runs through the language, messing it up..
 
C

Chris Hills

Keith Thompson said:
Actually, C89 *was* a local US standard, issued by ANSI. ISO adopted
it, with some editorial changes, as C90, then ANSI officially adopted
the ISO version. But the fact remains that C89 and C90 describe
exactly the same language.

So in an international NG why not refer to the ISO edition rather than a
local foreign one?
 
C

Chris Hills

Keith Thompson said:
Chris Hills said:
Keith Thompson said:
[...]
How can Microsoft's C library be conforming if it doesn't yet support
all of C99's requirements?

It is as good as most and better than quite a few I have been told by
people who should know.

The point, I presume, is that it conforms to C90 but not to C99 (as
many libraries do, at least to a first approximation).

No I was referring to C99

Just to be clear, you're saying that Microsoft's C library has good
(but presumably not quite complete) support for C99? That's
pleasantly surprising. The impression I've gotten here is that
Microsoft hasn't been particularly interested in C99 conformance.

[...]
The Safe C lib has about 2K functions in it. ISO C has 483? SO you
work out what the other 1500 are for.

I don't know what the other 1500 are for. Are you saying they're
Windows-specific?

That is what the fuss is about.

I assumed that embedded systems tend to be freestanding
implementations; if that's not correct, it's simply something I didn't
know, not narrow-mindedness.

It depends is the answer. On PIC's, 4, 8, 16, and 128 bit systems they
tend to be free-standing. On 32, and 64 bits hosted there are more that
are hosted. I think there are probably a dozen or so embedded RTOS and
OS (not all are hard real time) that is apart from Embedded XP, Wince
and Linux
Yes, there's more to life than embedded systems and PCs; that was
exactly my point. *If* this so-called "Safe C" library's primary
purpose is to provide safer versions of the existing standard C
library, then it should be equally useful on any hosted system.

Yes but as I said it has about 2000 functions in it and there are 480
(ish) in the standard library. If it was just the ISO library people
would not be complaining.
PCs
are just a subset of hosted systems, so I didn't understand why you
mentioned them. (I was thinking in particular of Unix systems, since
those are what I work on.)

I have just been given a couple of free SUN Ultra 10's :) I used to
work on Solaris about a decade ago so I am looking forward to getting
them installed on the network. Fortunatley they have VGA cards in them.
If, on the other hand, it contains a lot
of Windows-specific functionality, then offering it for
standardization doesn't make any sense -- nor does discussing it here,
really.

It does make a lot of sense to have a TR that contains all your OS
specific stuff in because then it is *ISO APPROVED* and any library
that does not contain your proprietary functions is not......

However as you discuss Standard C in this NG and take that to mean
C89-C99 + any TC, CD and TR it will by your own definition be valid for
discussion here.

You only have to look at the bun fight over C++/CLI to see where this is
going.
So, what are those other 1500 functions for?

MS Windows AFAIK though I expect they will argue that "anyone" can use
them.
 
K

Keith Thompson

Chris Hills said:
So in an international NG why not refer to the ISO edition rather than
a local foreign one?

Don't ask me; I generally do refer to C90. But it's not that big a
deal; as long as you're aware that C89 and C90 describe the same
language, you can treat them as synonymous (unless you're referring to
section numbers, but those are easy enough to translate).

I think Richard happens to have a copy of the ANSI C89 standard.
 
K

Keith Thompson

Chris Hills said:
That is what the fuss is about.

Does that mean "yes"? If so, are you sure about that?

[...]
Yes but as I said it has about 2000 functions in it and there are 480
(ish) in the standard library. If it was just the ISO library people
would not be complaining.

It's from Microsoft; of *course* people would be complaining.

[...]
It does make a lot of sense to have a TR that contains all your OS
specific stuff in because then it is *ISO APPROVED* and any library
that does not contain your proprietary functions is not......

Hmm. Frankly, I find it difficult to believe that the ISO C committee
would seriously consider endorsing a library that's specific to
Microsoft Windows.
However as you discuss Standard C in this NG and take that to mean
C89-C99 + any TC, CD and TR it will by your own definition be valid
for discussion here.

You only have to look at the bun fight over C++/CLI to see where this
is going.


MS Windows AFAIK though I expect they will argue that "anyone" can use
them.

Surely not without a licensed copy of MS Windows.

I think you're saying that (a) the "Safe C" library is largely
specific to MS Windows, and (b) it's being seriously considered for
standardization by the ISO C Committee. I can easily believe either
of these, but I'm hesitant to believe both. Can you provide
citations?
 
J

jacob navia

Keith Thompson a écrit :
I think you're saying that (a) the "Safe C" library is largely
specific to MS Windows, and (b) it's being seriously considered for
standardization by the ISO C Committee. I can easily believe either
of these, but I'm hesitant to believe both. Can you provide
citations?

This is 100% nonsense. There is nothing windows specific
in the proposal from Microsoft. Some people will say anything
against Microsoft, because is the "evil empire". OK, but
that has nothing to do with the truth.

I am in no way associated with them, but I do not see the world divided
into "good guys" and "bad guys", specially what concerns data
processing.

This proposal is a tiny step forward. That's all.
 
C

Christopher Layne

jacob said:
I am in no way associated with them, but I do not see the world divided
into "good guys" and "bad guys", specially what concerns data
processing.

This proposal is a tiny step forward. That's all.

How is a bunch of crappy checks to guard against clumsy programming a step
forward?

For straight out bad functions in the standard library, fine - but I don't
need additional logic checks in a library that should just do what it's told
and crash violently when it's told to do something wrong.
 
J

jacob navia

Christopher Layne a écrit :
jacob navia wrote:




How is a bunch of crappy checks to guard against clumsy programming a step
forward?

For straight out bad functions in the standard library, fine - but I don't
need additional logic checks in a library that should just do what it's told
and crash violently when it's told to do something wrong.

The safe c library will crash violently if you wish. You are allowed
to define a function that YOU write that will handle a constraint
violation. There you can write a violent crash if you wish so, or write
to a log file, or do nothing, whatever. It is quite flexible in this
point.
 
C

Christopher Layne

jacob said:
The safe c library will crash violently if you wish. You are allowed
to define a function that YOU write that will handle a constraint
violation. There you can write a violent crash if you wish so, or write
to a log file, or do nothing, whatever. It is quite flexible in this
point.

And yet, I can do that now.
 
S

santosh

jacob said:
Christopher Layne a écrit :

The safe c library will crash violently if you wish. You are allowed
to define a function that YOU write that will handle a constraint
violation. There you can write a violent crash if you wish so, or write
to a log file, or do nothing, whatever. It is quite flexible in this
point.

His point, with which I agree, is that the C library doesn't need
these "safe" functions. Afterall, MS does have their C#, where they
can add all the nonsense they desire. C's strength is simplicity.
Addition of ~1550 functions will completely trash the language.
 
C

Cesar Rabak

santosh escreveu:
His point, with which I agree, is that the C library doesn't need
these "safe" functions. Afterall, MS does have their C#, where they
can add all the nonsense they desire. C's strength is simplicity.
Addition of ~1550 functions will completely trash the language.
I do see a clash of your own logic here: people have written in this
thread against a "Safe C Library" as it were to become an obligatory
usage or worst, as if the present Standard C library would (by magic) go
away in become unavailable.

I see the proposal as a proposition to augment a [Standard] library in
order a safer set be within some time for the market settle available as
are now the other functions.

Still, everybody would have his rights of choice preserved. In the
longing C tradition.

my 0.019999....
 
K

Keith Thompson

jacob navia said:
Keith Thompson a écrit :

This is 100% nonsense. There is nothing windows specific
in the proposal from Microsoft. Some people will say anything
against Microsoft, because is the "evil empire". OK, but
that has nothing to do with the truth.

To be very clear, I was not stating my own opinion about the "Safe C"
library; I was merely trying to understand what Chris Hills was saying
in the previous article. I suspect that Chris was mistaken, but I'd
like to hear from him on this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,269
Latest member
vinaykumar_nevatia23

Latest Threads

Top