| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | [C] (Thanks)An interesting question |
Hey Pascal,
> Now let's try compiling a C program with minint in it:
Now why on Earth would you want to do that? You obviously could not
have understood either what I wrote or what Bob wrote. AFAIK any identifier
used in a program must be a keyword, or a function or macro listed in one
of the standard libraries, or must be declared.
> #include
> int foo = maxint;
> gcc -g -O2 -Wall -W -c -o minint.o minint.c
> minint.c:3: `minint' undeclared here (not in a
> function)
Neither maxint nor minint is a function or a macro. Both are generic
terms for an appropriate member of the set of macros listed to the right of
their appearance in italics in the book.
> No such problem occurs for INT_MAX.
Obviously - that (INT_MAX) is a macro and is defined in one of the
standard libraries. Any standard library function or macro may be used in a
program. Generic terms can't unless they are explicitly declared and
defined in the program or an included header.
> It would also be against the naming conventions used
> in the C standard to define a constant with a name in
> lower case.
This shows that you have not understood. That could be my fault. It is
not a constant. That is the whole point. At no point have I suggested it
was. Jasen said it was a constant in Pascal. We are discussing ANSI C. The
term maxint *is defined* in the standard, but not in the standard
libraries. Nor are they keywords. Therefore you cannot use them in a
program (unless you declare them yourself). The standard lists to the right
of the entry a set of macros from which the appropriate one may be selected
for use in a program, but for use in program specifications it is perfectly
understandable to use the generic terms. You had no trouble in
understanding Jasen when he talked about a signed integer being a whole
number in the range maxint to minint. Nor did anybody else.
In fact the whole thread is a bit silly, and having explained, I do not
see a lot of point in continuing it.
Best Wishes,
Bill.
---
* Origin: Escan BBS (2:25/200)SEEN-BY: 633/267 270 @PATH: 25/200 108 252/110 250/501 140/1 106/2000 633/267 |
|
| 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™.