Requesting advice how to clean up C code for validating string represents integer

  • Thread starter robert maas, see http://tinyurl.com/uh3t
  • Start date
R

robert maas, see http://tinyurl.com/uh3t

From: Chris Dollin said:
Actually no. The idea was that an lvalue was the /value/ that was
obtained by evaluating an expression which was to be assigned to,

No wonder everyone is confused. In the statement:
x = 5*w;
x is not a value of any kind, it's a **name** of a **variable**
which probably has a value but the value most certainly isn't x. If
w has the value 3, then after executing that statement x will have
the value 15. 15 isn't an lvalue, is it? But you say it is!!
Part of the reason for introducing this distinction was to
formalise why the variable `a` in `a := a + 1` means two
different things in the two different places: the left-hand
`a` is evaluated for its lvalue and the right-hand one for
its rvalue.

That's bullshit. 'a' is the *name* of a *place* where data can be
stored and later retrieved. Depending on where a place is specified
in a statement, either the retrieval-from-place or storage-into-place
operation may occur. Some expressions denote a place, such as 'a'
in the above example, or chs[2] in the following example:
char chs[30];
chs[2] = 'a' + 5;
printf("The third character is '%c'.\n", chs[2]);
Some expressions don't denote a place, such as "'a' + 5" in the
above example. Such expressions can be used only to produce a value
*from* the expression, not to store a value gotten from elsewhere
*into* the expression.

There are basically three kinds of these expressions:
- Readonly, such as input channels (stdin), and 'a' + 5
- Writeonly, such as output channels (stdout, errout)
- Read/Write **place**s, as discussed above
Well I guess there's a fourth kind, something where you can read
and write but what you read isn't what you wrote there previously.
For example, it's possible in some langauges to define an
input/output channel as a single object, for example stdin/stdout
together, which is a useful concept if you want to perform
rubout/backspace processing of input in a user-friendly way.
In some languages, literals have lvalues, so the assignment
`1 := 2` is legal. Depending on the language semantics, `1`
may have a single lvalue, or a different one each time it
is evaluated. (The rvalue of `1` might or might not use its
lvalue.) While for assignment this looks like the rabid
and hungry sabre-toothed tiger, it makes more sense for
parameter-passing ...

I fail to see how it makes any sense at all. In Fortran on the IBM
1620, you could in fact do that. For example (forgive me if I don't
have the syntax exactly correct after 40 years):

SUBROUTINE MANGLE(N)
N = 5;
END

CALL MANGLE(3)
GOTO 3
5 ... (it goes to here, because the literal 3 in the table of
constants, used by the GOTO statement, has been mangled to have the
value 5 now, but the symbol table mapping line numbers to locations
in the compiled code still links 5 to this statement)

I got bitten by that at least once, a really difficult bug to diagnose.
the lvalue is the value you get /by evaluating on the left/; you
may then be able to store into (through?) it, or not.

That's a completely garbled way of thinking of it. To store a value
into a place you need to know what function to call to effect the
storage. Common Lisp clarifies the whole idea best with SETF.
There's a function CAR which returns the left side of a pair, and
the function RPLACA which stores a value in the left side of a
pair, leaving the right side unchanged. You can say (setf (car x)
y), i.e. in c notation car(x) = y. How does this work?? There's a
SETF method for CAR, whereby (setf (car x) y) is macro-expanded
into (rplaca x y).

Now consider CADDR, which is defined such that (CADDR x) means (CAR
(CDR (CDR x))). Now suppose you want to say (setf (caddr x) y).
What does that do? How does it work? There's a SETF method that
causes (setf (caddr x) y) to macro-expand to (rplaca (cddr x) y).

The important point is that it's not enough to evaluate the left
side of the assignment to see where the cell is that needs
modifying, you must also say what function to call to modify just
part of that cell, not the the whole thing. If you say (setf (cddr
x) y), it expands into (rplacd (cdr x) y), i.e. it goes as deep as
(cdr x) to get the object that needs modifying, but the it does
RPLACD instead of RPLACA of that object. It's not enough to say
where to make the change, you must say how specifically to make the
change there, whether to modify the left side or the right side.

You can go even smaller than the byte level of access. For example,
suppose you want to store a large number of ENUMs, where each ENUM
has four possible values 0,1,2,3, thus requiring only two bits
each, so you want to pack four ENUMs into each 8-bit byte, and have
a huge array of millions of these four-to-a-byte structures, and
you want to emulate a huge array that directly indexes the
individual ENUMs. It's easy in Common Lisp: First you define a
function for reading out the individual ENUM at location IX,
something like this (I'm using c notation here to make it easier
for you to understand):
ENUM four getfour(unsiged byte *arr, int ix) {
int arrix, subix, nshift;
arrix = ix/4;
subix = ix%4;
nshift = 2*subix;
return (ENUM four)((arr[arrix] >> nshift) & 3);
}

Now you define a function for storing an ENUM into the same place
you got it from, something like this:
void putfour(unsiged byte *arr, int ix, ENUM four newval) {
int arrix, subix, nshift;
arrix = ix/4;
subix = ix%4;
nshift = 2*subix;
arr[arrix] = (arr[arrix] & (~ (3 << nshift)))
| (((unsiged byte)newval) << nshift);
}

Now (what you can do *only* in Common Lisp), you define a SETF
method so that the code:
getfour(bigarr,ix) = newval;
will macro-expand into:
putfour(bigarr,ix,newval);
That makes it easy to copy a ENUM from one place to another,
for example:
getfour(bigarr,ix1) = getfour(bigarr,ix2);
exactly like you can already (in c) do:
arr[ix1] = arr[ix2];
so you don't have to write this ugly assymtric code instead:
putfour(bigarr,ix1,getfour(bigarr,ix2));
putarr(arr,ix1,arr[ix2]);

In summary, there's no value (usefulness) to an "lvalue" as you explain it.
What is misnomered an "lvalue" is really c's version of a setf method,
which unfortunately can't be extended by users as it can in lisp.
 
B

Ben Bacarisse

No wonder everyone is confused.

I don't feel confused.
In the statement:
x = 5*w;
x is not a value of any kind, it's a **name** of a **variable**
which probably has a value but the value most certainly isn't x. If
w has the value 3, then after executing that statement x will have
the value 15. 15 isn't an lvalue, is it? But you say it is!!

No, 15 is not an lvalue and I did not see anything in what Chris
Dollin wrote that says it is.

The standard is quite clear on the matter: some expressions yield
lvalues and some do not. The multiplication operator, *, does not
yield and lvalue. Simple variables, like x and w above, do.

The standard also says what happens when a lvalue, like w, appears in
an expression: it is almost always converted to the contents of the
object it denotes (my words, but look up section 6.3.2.1 if you want
the actual ones). One important place where an lvalues does not get
converted to a "plain" value is on the left of an assignment operator,
like x above.
That's bullshit.

No, I think it is reasonable (though informal) definition of why the
term came into common use. If you want a very formal analysis you
must turn to denotational semantics, originally developed by
Christopher Stratchey and Dana Scott. I think Chris Dollin referred
to Strachey if not to the topic of denotational semantics.
'a' is the *name* of a *place* where data can be
stored and later retrieved. Depending on where a place is specified
in a statement, either the retrieval-from-place or storage-into-place
operation may occur. Some expressions denote a place, such as 'a'
in the above example, or chs[2] in the following example:
char chs[30];
chs[2] = 'a' + 5;
printf("The third character is '%c'.\n", chs[2]);
Some expressions don't denote a place, such as "'a' + 5" in the
above example. Such expressions can be used only to produce a value
*from* the expression, not to store a value gotten from elsewhere
*into* the expression.

There are basically three kinds of these expressions:

Here you define your own way of looking at variables and expressions,
but unless your terms (and the way you think about them) correspond to
the way variables and expressions are defined by the C standard, all
you will do is confuse yourself -- at least as far as understanding C
is concerned. Ask yourself, for example, if your characterisation of
expressions helps explain the behaviour of operators like sizeof.

<descriptions of other languages snipped>
 
R

Richard Heathfield

robert maas, see http://tinyurl.com/uh3t said:
I can understand why K&R might have used such obsolete jargon,
before it was fully realized how confusing it is,

Most people don't find it confusing.
but I see no
excuse for current online documentation, especially FAQs to
continue to perpetuate such misleading obsolete jargon.

It's not obsolete. It's not even particularly misleading. It's just one
of those things you learn along the way.
That's completely wrong.

No, it isn't. Look, almost everything you've said about C, here and
elsewhere, is wrong, so I think it'd be better for you to spend a
little less time arguing with experts and a little more time listening
to them.
A simple variable is an lvalue, but it's
not an object, it's a primitive type.

C doesn't define "variable", but most people seem to use it in a sense
which is broadly in line with the term "object". A type is (sort of) a
handy label for the properties of an object, but it does not of itself
have any storage assigned to it at runtime, so a type cannot store a
value, but an object can.
(And in the jargon of OOP,

Who mentioned OOP?
nothing whatsoever in C is an object. But using the older lisp
jargon, an array is an object but a simple variable isn't.)

In C terms, an int object is an object.
It *is* your responsibility if you tell me to spend money I don't
have after I've already told you of my situation.

No, it isn't.
So in the future... DON'T!

It is *your* responsibility to make yourself knowledgeable about C
before trying to conduct discussions in it, and this would certainly
include obtaining basic textbooks on the language. If you aren't
prepared to mow a few lawns to raise the money needed to buy a copy of
K&R2, and if you're not prepared to ask the library to lend you a copy
for a while, then you should not be surprised if your ignorance of C
leads people to correct you frequently.

In short, it is your responsibility to know what you're talking about if
you argue with C experts.

So in the future...
 
K

Keith Thompson

I can understand why K&R might have used such obsolete jargon,
before it was fully realized how confusing it is, but I see no
excuse for current online documentation, especially FAQs to
continue to perpetuate such misleading obsolete jargon.

There is nothing misleading about it if you understand how the word is
used. An lvalue, in modern C (at least since 1989) is an expression
that denotes an object.
That's completely wrong. A simple variable is an lvalue, but it's
not an object, it's a primitive type. (And in the jargon of OOP,
nothing whatsoever in C is an object. But using the older lisp
jargon, an array is an object but a simple variable isn't.)

You have a habit of claiming that various things are completely wrong.
In most cases, you are mistaken. I suggest checking your facts more
carefully before making such claims.

In C, an "object" is, by definition, a "region of data storage in the
execution environment, the contents of which can represent values"
(C99 3.14). Nothing more, nothing less. The term is not related to
OOP. (Incidentally, the C++ standard has a similar definition of
"object".) So yes, a simple variable is an object.

[snip]

If you can't afford a copy of K&R2 (and don't have access to a public
library), Google n1124.pdf. It's free.
 
K

Keith Thompson

I take your advice for best practice is first check return value to
see if it's negative or whatever the criterion is for unsuccessful,
and if unsuccessful then check feof() and errno to diagnose why it
failed?

You need to check the documentation for each function to see how it
behaves.

fgetc(), for example, returns EOF (not just any negative value) on
reaching end-of-file or on an error. After getting an EOF result, you
can call feof() and/or ferror(). The standard doesn't say that errno
is set on an error, though it may be in some implementations.
 
M

Malcolm McLean

I can understand why K&R might have used such obsolete jargon,
before it was fully realized how confusing it is, but I see no
excuse for current online documentation, especially FAQs to
continue to perpetuate such misleading obsolete jargon.


That's completely wrong. A simple variable is an lvalue, but it's
not an object, it's a primitive type. (And in the jargon of OOP,
nothing whatsoever in C is an object. But using the older lisp
jargon, an array is an object but a simple variable isn't.)
There is a case for using terms in the way the ANSI committee do in the C
standard.

However the committee is not important enough to be allowed to define how we
use basic programming terms in the English language, even in a C context. If
you are using a term that has other meanings, like "object", in the sense
defined by the standard, then really you ought to qualify "as defined by the
standard".
 
R

Racaille

Part of my decision was that whitespace allowance should be
symmetric. It should be allowed before iff allowed after. strtol is
assymtric in this respect, allowing whitespace before (and
rejecting stray non-white text before), but failing to distinguish
between trailing whitespace (OK) and trailing junk (Not OK), either
rejecting both (if caller checks to make sure the final pointer
matches end of string), or accepting both (if caller doesn't make
that check).

I would just use sscanf() and be done:

char junk;
switch(sscanf(str, "%d %c", &num, &junk)){
case 1:
/* OK, 'num' is your number */
break;
case 2:
/* FAIL, there was some trailing junk */
break;
case 0:
/* FAIL, invalid number */
break;
default:
/* FAIL, the string was either zero-length
or just whitespaces */
}

I'm not sure if the last 2 cases could be portably
distinguished.
 
K

Keith Thompson

Malcolm McLean said:
There is a case for using terms in the way the ANSI committee do in the C
standard.

However the committee is not important enough to be allowed to
define how we use basic programming terms in the English language,
even in a C context. If you are using a term that has other
meanings, like "object", in the sense defined by the standard, then
really you ought to qualify "as defined by the standard".

Be aware that I, for one, will not necessarily bother to do so when
posting in this newsgroup. I might when it's necessary to avoid
confusion, but my threshold of confusion many differ from yours.
 
K

Keith Thompson

Racaille said:
I would just use sscanf() and be done:

char junk;
switch(sscanf(str, "%d %c", &num, &junk)){
case 1:
/* OK, 'num' is your number */
break;
case 2:
/* FAIL, there was some trailing junk */
break;
case 0:
/* FAIL, invalid number */
break;
default:
/* FAIL, the string was either zero-length
or just whitespaces */
}

I'm not sure if the last 2 cases could be portably
distinguished.

C99 7.19.6.7p3:
The sscanf function returns the value of the macro EOF if an input
failure occurs before any conversion. Otherwise, the sscanf
function returns the number of input items assigned, which can be
fewer than provided for, or even zero, in the event of an early
matching failure.

Unfortunately, sscanf() with "%d" invokes undefined behavior if the
number can't be represented as an int (i.e., on overflow).
 
R

Richard Heathfield

Malcolm McLean said:

There is a case for using terms in the way the ANSI committee do in
the C standard.
Yes.

However the committee is not important enough to be allowed to define
how we use basic programming terms in the English language, even in a
C context.

What a strange way to put it.
If you are using a term that has other meanings, like
"object", in the sense defined by the standard, then really you ought
to qualify "as defined by the standard".

Not in *this* newsgroup, though. This is a C newsgroup, and in C the
word "object" has a definite and widely known meaning. If you want to
add useless qualifiers to your articles, that's up to you, but nobody
else is under any obligation to copy you.
 
R

robert maas, see http://tinyurl.com/uh3t

From: "Malcolm McLean said:
There is a case for using terms in the way the ANSI committee do
in the C standard.
However the committee is not important enough to be allowed to
define how we use basic programming terms in the English language,
even in a C context. If you are using a term that has other
meanings, like "object", in the sense defined by the standard,
then really you ought to qualify "as defined by the standard".

Well said. Thanks for expressing that opinion better than I could myself.

As for sensible (non-ANSI) language: An "object" to me means
something that (1) is connected together so the various parts of it
don't easily drift apart, and (2) is itself capable of moving
independently of anything else. So an automobile is an "object",
but the engine block of that automobile while firmly locked within
the automobile is not an "object" itself, rather it's just part of
a larger object. Likewise an array is an object, because you can
easily move the object to a new location without losing any of its
importat structure, for example by moving the line of source code
and recompiling, or by calling malloc and copying the array to the
newly allocated storage. But a single element of an array is *not*
an object, because it's firmly fixed adjacent to the other elements
of that same array, and if you move that array element all by
itself to a new location you lose the structure you had whereby it
could be indexed along with all the other array elements in a
uniform manner.

Now an indivisible thing, such as an electron, isn't an object,
it's just a particle. You need a large number of particles before
you have anything properly called an "object". Is a single molecule
of carbon dioxide an "object"? Probably not. Is a complete strand
or loop of DNA an "object"? Probably not, but maybe. Is a complete
living cell an "object"? Probably yes, unless it's firmly fixed
within a living body and you're talking about the body as a whole.
Is a single integer variable an "object"? Probably not, unless
you're treating it as a bit vector.

I think the ANSI committee has abused the word "object" to have too
broad a meaning, losing the essential idea that was originally in
the word, to be acceptable to me, and apparantly to you either,
except in the coerced context of working on standards that mesh
with the ones the committee already did.

I sorta like the terms "object" for something that has more than
one addressible/indexable part, and can move as a unit
independently of other "objects", and the term "slot" for an
individually addressible/indexable part of an object, and the term
"place" for either a slot or a standalone variable where you can
store a value and later retrieve it. In a database the
corresponding terms are "record" (object) and "field" (slot). If
ANSI tries to refer to a single field within a record as an
"object", I don't have to copy their usage.

I suppose to be fair (same rules for goose and gander), I should
qualify my usage too:

"place" as used in Common Lisp SETF-method jargon.

"object" as used in Lisp jargon ever since the early times.
-or-
"object" as used in Java/OOP jargon.

"method" as used in Common Lisp SETF jargon.
-or-
"method" as used in Java/OOP jargon.

"function" as used in mathematics.
-or-
"function" as used in FORTRAN jargon (can't side-effect arguments).
-or-
"function" as used in C/lisp jargon (*can* side-effect via pointer arguments).
-or-
"function" as used in C++ jargon (direct manipulation of reference arguments).
 
B

Beliavsky

On Feb 18, 2:28 pm, (e-mail address removed) (robert maas, see http://tinyurl.com/uh3t)
wrote:

I suppose to be fair (same rules for goose and gander), I should
qualify my usage too:

"place" as used in Common Lisp SETF-method jargon.

"object" as used in Lisp jargon ever since the early times.
-or-
"object" as used in Java/OOP jargon.

"method" as used in Common Lisp SETF jargon.
-or-
"method" as used in Java/OOP jargon.

"function" as used in mathematics.
-or-
"function" as used in FORTRAN jargon (can't side-effect arguments).

Fortran functions can change their arguments, although I think doing
so is poor
style and that a SUBROUTINE should be used if one desires this
behavior. In Fortran 95, one can specify that a function is PURE, in
which case it is not allowed to change its arguments.
 
R

robert maas, see http://tinyurl.com/uh3t

From: "Racaille said:
I would just use sscanf() and be done:

That may be what you would do, but I prefer to do better than that.
A week or so ago I discovered strcspn which allows me to
immediately learn whether the user typed any digit whatsoever or
not, and if so then where that first digit is. That applies the
divide-and-conquer pattern: Once I know where that first digit is,
the overall task sub-divides into (1) checking backwards for
immediate optional sign, and before that only whitespace, and (2)
checking forwards for rest of digits, and after that only
whitespace. In fact the two sub-tasks could be parallelized if that
was of any value. strcspn and strspn are handy for those sub-tasks
too. It's too bad this kind of task never came up in those three c
programming classes I took, so the instructor never mentioned such
useful functions, or I would have used them from the start, and
never would have written that ugly first version of my syntax
checker. In lisp of course you don't need such functions built-in,
because it's trivial for ordinary programmers to pass an anonymous
function to POSITION-IF or POSITION-IF-NOT to achieve the same
effect (in fact that's what I did for the lisp version of the
algorithm, and re-invented strcspn and strspn under different names
for the java version before I discovered those functions in the c
library). I think my Java names make more sense than the c names BTW.

By the way, last night as I was glomping a c library into my
multi-language cookbook matrix, I got to the point where strcspn
and strspn appear, so they're in there, alongside the Common Lisp
equivalents, as of last night. Take a look if you're curious:
Start at the top of:
<http://www.rawbw.com/~rem/HelloPlus/CookBook/Matrix.html>
Find either of these in table of contents:
+ Integers ...
and ... Strings (click here)
+ [Strings]
and ... Integers (click here)
Or cheat by using this direct URL:
<http://www.rawbw.com/~rem/HelloPlus/CookBook/Matrix.html#StrInt>
but if you do that you lose the fun of seeing how the coordination
of data types works in my cookbook matrix.
However you've gotten to the "Strings and Integers" section,
next skim-read until you reach this paragraph:
Skip over particular characters in string
and the next after it:
Skip until first particular character in string
That's the best natural English description I've been able to
figure out. In the technical descrption I use the jargon of "bag of
characters", but I feel that's not best in the brief initial
description for eyeballing purpose. I you can think of better
English here, feel free to post a suggestion. (Also I proofread the
technical spec I wrote several times, kept finding mistakes and
fixing them, and finally the last two proofreadings didn't find
anything wrong, so I think I finally got it right, or did I?)
 
K

Keith Thompson

I think the ANSI committee has abused the word "object" to have too
broad a meaning, losing the essential idea that was originally in
the word, to be acceptable to me, and apparantly to you either,
except in the coerced context of working on standards that mesh
with the ones the committee already did.
[...]

That's just too bad.

This is comp.lang.c, where we discuss the C programming language,
which is defined by the ISO C standard, which has a perfectly good
technical definition for the word "object". If you want to use the
word "object" *in this newsgroup* in a different sense, then I suggest
you state explicitly that you're doing so. Otherwise, I (and probably
many others) will correct your misuse of the word, or will just ignore
you.

I'm not saying that you shouldn't discuss "objects" in the OOP sense,
or in the sense of physical things, or whatever. I'm just saying that
*in this newsgroup*, the word has the overriding meaning of a "region
of data storage in the execution environment, the contents of which
can represent values".

I suppose the authors of the C standard could have invented new words
that couldn't be confused with existing English words, but I doubt
that you'd want to read about ferlorping a kurplok rather than
declaring an object.
 
K

Keith Thompson

Yevgen Muntyan said:
robert said:
From: "Racaille" <[email protected]>
I would just use sscanf() and be done:
[snip]
Start at the top of:
<http://www.rawbw.com/~rem/HelloPlus/CookBook/Matrix.html>

What's "GNU-c" and why are some functions "GNU-c" while others
are "c"? Then some people read it and think they use GNU-c,
as some people use C/C++...

GNU C is the C-like language accepted by gcc. It's very similar to
standard C, but has a number of extensions, some of which violate the
C standard.

Note that gcc is a compiler, not a complete implementation; the C
runtime library is provided separately, and varies from one platform
to another. There is a GNU C library (separate from, but usable with,
gcc).

But I have no idea why the referenced web page applies the "GNU-c" tag
to the isblank() and strtoll() functions, both of which are standard C
(but both are new in C99).
 
C

CBFalconer

Keith said:
Yevgen Muntyan said:
robert maas, see http://tinyurl.com/uh3t wrote:

[snip]

What's "GNU-c" and why are some functions "GNU-c" while others
are "c"? Then some people read it and think they use GNU-c,
as some people use C/C++...

GNU C is the C-like language accepted by gcc. It's very similar
to standard C, but has a number of extensions, some of which
violate the C standard.

Note that gcc is a compiler, not a complete implementation; the
C runtime library is provided separately, and varies from one
platform to another. There is a GNU C library (separate from,
but usable with, gcc).

But I have no idea why the referenced web page applies the
"GNU-c" tag to the isblank() and strtoll() functions, both of
which are standard C (but both are new in C99).

I believe the referenced page is authored by Maas. If Yevgen scans
old posts in this newsgroup for Maas's posts (google is handy for
this), and the myriad corrections required, he may be able to
evaluate the accuracy of that page, at least as far as it applies
to C.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
 
M

Malcolm McLean

Richard Heathfield said:
Not in *this* newsgroup, though. This is a C newsgroup, and in C the
word "object" has a definite and widely known meaning. If you want to
add useless qualifiers to your articles, that's up to you, but nobody
else is under any obligation to copy you.
In the C standard the term "object" has a very specific definition. When
most C programmers use the term "object" they are not using it in this
sense, probably even when specifically discussing C.

The standard is an important document, so we can hardly hold that it is
wrong to use its terminology, even where it is somewhat eccentric. However
we cannot allow it to totally dictate our discourse. There aren't enough
words for that. Or in programming terms, they have polluted our namespace.
 
R

Richard Heathfield

Malcolm McLean said:
In the C standard the term "object" has a very specific definition.
Correct.

When most C programmers use the term "object" they are not using it in
this sense, probably even when specifically discussing C.

That's their problem. :)
The standard is an important document, so we can hardly hold that it
is wrong to use its terminology, even where it is somewhat eccentric.

Quite so.
However we cannot allow it to totally dictate our discourse.

I don't. If I use the word "object" in a non-C context, I intend it to
carry a very different meaning than when I use it in a C context. Same
applies to char, long, short, float, double, pointer, file, array,
value, and so on. If I ask my wife whether she'll be long, I don't
imagine for a second that she will interpret that as a query as to
whether she intends to be an at-least-32-bits-wide integer.

But in a C context, these words have more specialised meanings.
There
aren't enough words for that. Or in programming terms, they have
polluted our namespace.

Well, yes, ISO have polluted our namespace, but not for that reason.
 
Y

Yevgen Muntyan

Keith said:
Yevgen Muntyan said:
robert said:
From: "Racaille" <[email protected]>
I would just use sscanf() and be done: [snip]
Start at the top of:
<http://www.rawbw.com/~rem/HelloPlus/CookBook/Matrix.html>
What's "GNU-c" and why are some functions "GNU-c" while others
are "c"? Then some people read it and think they use GNU-c,
as some people use C/C++...

GNU C is the C-like language accepted by gcc. It's very similar to
standard C, but has a number of extensions, some of which violate the
C standard.

You sure you are talking about the same thing as that silly "GNU-c"
on the website?
Note that gcc is a compiler, not a complete implementation; the C
runtime library is provided separately, and varies from one platform
to another. There is a GNU C library (separate from, but usable with,
gcc).

Yeah, noted that. There are also many other libraries out there.
And there is also an Intel C compiler. Then, I like Adobe Photoshop,
one can draw pictures in it.
But I have no idea why the referenced web page applies the "GNU-c" tag
to the isblank() and strtoll() functions, both of which are standard C
(but both are new in C99).

Exactly. That's my question, "why the heck?".

Yevgen
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top