473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

L_tmpnam macro

Was the ``L_tmpnam'' [7.9.1/7.4.4] macro given that mixed case name by a
deliberate design decision?

Is it the only macro expanding to an integral constant expression that has
lowercase characters in the name?
Jun 27 '08 #1
18 1664
Bob Nelson wrote:
Was the ``L_tmpnam'' [7.9.1/7.4.4] macro given that mixed case name by a
deliberate design decision?
[...]
My botch: ``s/7.7.4/7.9.4/''.

Jun 27 '08 #2
Bob Nelson <bn*****@nelsonbe.comwrites:
Was the ``L_tmpnam'' [7.9.1/7.4.4] macro given that mixed case name by a
deliberate design decision?
You mean 7.9.1/7.9.4.4. Both refer to sections in the C90 standard.

I presume it was deliberate. The uppercase 'L' partially follows the
convention of uppercase macro names. The lowercase "tmpnam" refers to
the tmpnam() function.
Is it the only macro expanding to an integral constant expression that has
lowercase characters in the name?
No, here's another one:

#define the_answer 42

But seriously, C99's <stdbool.hhas macros "false", "true", and
"__bool_true_false_are_defined". Those are the only ones I can think
of. If you're more interested in the answer than I am 8-)}, you can
always look through the standard for other examples.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #3
Bob Nelson wrote:
Was the ``L_tmpnam'' [7.9.1/7.4.4] macro given that mixed case name by a
deliberate design decision?

Is it the only macro expanding to an integral constant expression that has
lowercase characters in the name?
In C89 there's also:
offsetof
stdin
stdout
stderr
assert
errno
va_start
va_arg
va_copy

C99 has more.

--
pete
Jun 27 '08 #4
pete <pf*****@mindspring.comwrote:
Bob Nelson wrote:
Is it the only macro expanding to an integral constant expression that has
lowercase characters in the name?

In C89 there's also:
offsetof
stdin
stdout
stderr
assert
errno
va_start
va_arg
va_copy
None of those expand to an integral _constant_ expression.

Richard
Jun 27 '08 #5
pete said:
Bob Nelson wrote:
>Was the ``L_tmpnam'' [7.9.1/7.4.4] macro given that mixed case name by a
deliberate design decision?

Is it the only macro expanding to an integral constant expression that
has lowercase characters in the name?

In C89 there's also:
offsetof
stdin
That doesn't look like any kind of integral constant expression to me.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #6
In article <48*****************@news.xs4all.nl>,
Richard Bos <rl*@hoekstra-uitgeverij.nlwrote:
Is it the only macro expanding to an integral constant expression that has
lowercase characters in the name?
>In C89 there's also:
offsetof
stdin
stdout
stderr
assert
errno
va_start
va_arg
va_copy
>None of those expand to an integral _constant_ expression.
offsetof does.

-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
Jun 27 '08 #7
Richard Tobin wrote:
In article <48*****************@news.xs4all.nl>,
Richard Bos <rl*@hoekstra-uitgeverij.nlwrote:
>>>Is it the only macro expanding to an integral constant expression that has
lowercase characters in the name?
>>In C89 there's also:
offsetof
stdin
stdout
stderr
assert
errno
va_start
va_arg
va_copy
>None of those expand to an integral _constant_ expression.
Oops!
>
offsetof does.

--
pete
Jun 27 '08 #8
Keith Thompson wrote:
Bob Nelson <bn*****@nelsonbe.comwrites:
>Was the ``L_tmpnam'' [7.9.1/7.4.4] macro given that mixed case name by a
deliberate design decision?

You mean 7.9.1/7.9.4.4. Both refer to sections in the C90 standard.

I presume it was deliberate. The uppercase 'L' partially follows the
convention of uppercase macro names. The lowercase "tmpnam" refers to
the tmpnam() function.
And what of ``fopen_MAX'' where the lowercase ``fopen'' refers to the
fopen() function?

Hmmm...that macro is, of course, ``FOPEN_MAX''. So why was similar naming
convention not used with ``L_TMPNAM''?

(I think that ``L_tmpnam'' is singular as the only macro defined by the
language using mixed case.)
Jun 27 '08 #9
Bob Nelson <bn*****@nelsonbe.comwrites:
Keith Thompson wrote:
>Bob Nelson <bn*****@nelsonbe.comwrites:
>>Was the ``L_tmpnam'' [7.9.1/7.4.4] macro given that mixed case name by a
deliberate design decision?

You mean 7.9.1/7.9.4.4. Both refer to sections in the C90 standard.

I presume it was deliberate. The uppercase 'L' partially follows the
convention of uppercase macro names. The lowercase "tmpnam" refers to
the tmpnam() function.

And what of ``fopen_MAX'' where the lowercase ``fopen'' refers to the
fopen() function?

Hmmm...that macro is, of course, ``FOPEN_MAX''. So why was similar naming
convention not used with ``L_TMPNAM''?
Because the C standard is not an absolutely coherent document
describing a perfect language designed by superhumans. The language
was designed by very smart people (mostly one very smart person) who
make mistakes. Parts of the library were designed by different people
in different places, who didn't necessarily consult with each other.
The standard committee had the job of tying all this together into a
single document that everyone could agree on.

It's remarkable that it's as consistent and coherent as it is.
(I think that ``L_tmpnam'' is singular as the only macro defined by the
language using mixed case.)
Nope.

C99's <complex.hhas _Complex_I, and optionally _Imaginary_I.

C99's <inttypes.hdefines a large number of macros for format
specifiers that use mixed case (e.g., PRIdMAX to print an intmax_t
value in decimal).

I found these simply by looking at the beginning of each subsection of
section 7 of the standard (or rather, of the latest draft, available
at <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #10
Keith Thompson wrote:
Bob Nelson <bn*****@nelsonbe.comwrites:
>Keith Thompson wrote:
>>Bob Nelson <bn*****@nelsonbe.comwrites:
Was the ``L_tmpnam'' [7.9.1/7.4.4] macro given that mixed case name by
a deliberate design decision?

You mean 7.9.1/7.9.4.4. Both refer to sections in the C90 standard.

I presume it was deliberate. The uppercase 'L' partially follows the
convention of uppercase macro names. The lowercase "tmpnam" refers to
the tmpnam() function.

And what of ``fopen_MAX'' where the lowercase ``fopen'' refers to the
fopen() function?

Hmmm...that macro is, of course, ``FOPEN_MAX''. So why was similar naming
convention not used with ``L_TMPNAM''?

Because the C standard is not an absolutely coherent document
describing a perfect language designed by superhumans. The language
was designed by very smart people (mostly one very smart person) who
make mistakes. Parts of the library were designed by different people
in different places, who didn't necessarily consult with each other.
The standard committee had the job of tying all this together into a
single document that everyone could agree on.

It's remarkable that it's as consistent and coherent as it is.
Yes indeed, as Dennis Richie stated: ``C is quirky, flawed and an enormous
success.'' Although I don't think it necessarily takes ``superhuman''
designers to be consistent in the naming style of macros, a dose of
pedantry could have helped in this regard. :-)
>(I think that ``L_tmpnam'' is singular as the only macro defined by the
language using mixed case.)

Nope.

C99's <complex.hhas _Complex_I, and optionally _Imaginary_I.

C99's <inttypes.hdefines a large number of macros for format
specifiers that use mixed case (e.g., PRIdMAX to print an intmax_t
value in decimal).
After reviewing both the C99 draft and ISO/IEC 9899:1990, the statement can
be modified as follow (modulo something I overlooked in my reading):

I think that ``L_tmpnam'' is the only macro defined by the language using
mixed case AND expanding to an integral constant.
Jun 27 '08 #11
Bob Nelson <bn*****@nelsonbe.comwrites:
Keith Thompson wrote:
>Bob Nelson <bn*****@nelsonbe.comwrites:
[...]
>>Hmmm...that macro is, of course, ``FOPEN_MAX''. So why was similar naming
convention not used with ``L_TMPNAM''?

Because the C standard is not an absolutely coherent document
describing a perfect language designed by superhumans. The language
was designed by very smart people (mostly one very smart person) who
make mistakes. Parts of the library were designed by different people
in different places, who didn't necessarily consult with each other.
The standard committee had the job of tying all this together into a
single document that everyone could agree on.

It's remarkable that it's as consistent and coherent as it is.

Yes indeed, as Dennis Richie stated: ``C is quirky, flawed and an enormous
success.'' Although I don't think it necessarily takes ``superhuman''
designers to be consistent in the naming style of macros, a dose of
pedantry could have helped in this regard. :-)
The problem, I think, is that the library is a collection of pieces
developed by different people. L_tmpnam, by itself, is a reasonably
sensible name -- and by the time it was merged with the other pieces
to form what we know as the standard library, changing the name to fit
a consistent naming scheme would have broken existing code.

[snip]

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #12

"Keith Thompson" <ks***@mib.orgschreef in bericht
news:ln************@nuthaus.mib.org...
The problem, I think, is that the library is a collection of pieces
developed by different people. L_tmpnam, by itself, is a reasonably
sensible name -- and by the time it was merged with the other pieces
to form what we know as the standard library, changing the name to fit
a consistent naming scheme would have broken existing code.
Since it wasnt standardized yet changing the name would not break existing
code anymore than if they took a different name from another library. On top
of that it would only break if the name was defined in a standard header and
the final standard did not have this name. If they used their own header
there would be no problem so I dont think breaking code was the issue here,
just miscommunication or an oversight or something. No biggie anyway

Jun 27 '08 #13
Serve Lau wrote:
>
"Keith Thompson" <ks***@mib.orgschreef in bericht
news:ln************@nuthaus.mib.org...
>The problem, I think, is that the library is a collection of pieces
developed by different people. L_tmpnam, by itself, is a reasonably
sensible name -- and by the time it was merged with the other pieces
to form what we know as the standard library, changing the name to fit
a consistent naming scheme would have broken existing code.

Since it wasnt standardized yet changing the name would not break
existing code anymore than if they took a different name from another
library. [...]
Um, er, WHAT??!

Are you claiming that no C code existed before 1989?
That ANSI decided to write a standard for a language that
had not yet been used, or had been used only for throwaway
programs of no importance?

L_tmpnam -- and printf, and gets, and int, and ...
are older than any C language standard, and were in use
long before a standard appeared on the scene.

(Something about this reminds me of the story of the
guy who tripped and fell heavily next to a seismometer,
causing a devastating earthquake in East Berzerkistan. Or
the story of the city slicker on his first visit to a hog
farm, watching the pigs being slopped and remarking "No
wonder they're called `pigs'.")

--
Eric Sosman
es*****@ieee-dot-org.invalid
Jun 27 '08 #14
In article <b6***************************@cache3.tilbu1.nb.ho me.nl>,
Serve Lau <ni***@qinqin.comwrote:
>The problem, I think, is that the library is a collection of pieces
developed by different people. L_tmpnam, by itself, is a reasonably
sensible name -- and by the time it was merged with the other pieces
to form what we know as the standard library, changing the name to fit
a consistent naming scheme would have broken existing code.
>Since it wasnt standardized yet changing the name would not break existing
code anymore than if they took a different name from another library.
You might as well say that as C wasn't standardised yet, changing it
to be Fortran would not have broken any existing programs.

-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
Jun 27 '08 #15

"Eric Sosman" <es*****@ieee-dot-org.invalidschreef in bericht
news:-8******************************@comcast.com...
Serve Lau wrote:
>>
"Keith Thompson" <ks***@mib.orgschreef in bericht
news:ln************@nuthaus.mib.org...
>>The problem, I think, is that the library is a collection of pieces
developed by different people. L_tmpnam, by itself, is a reasonably
sensible name -- and by the time it was merged with the other pieces
to form what we know as the standard library, changing the name to fit
a consistent naming scheme would have broken existing code.

Since it wasnt standardized yet changing the name would not break
existing code anymore than if they took a different name from another
library. [...]

Um, er, WHAT??!

Are you claiming that no C code existed before 1989?
That ANSI decided to write a standard for a language that
had not yet been used, or had been used only for throwaway
programs of no importance?
of course not, I meant they took a name (L_tmpnam) from a library and
standardised that. You cant tell me there was no other codebase at the time
using a different name. Breaking code should not have been the issue here.
Actually, why is it such a bad thing that an added macro would break
existing code, its about a compile time issue.
Suppose they named it TMPNAM_MAX and the L_tmpnam code broke because the
name doesnt exist anymore. You switch to the new compiler, your code doesnt
compile anymore, you check why and find out about the new name. You check to
see what it expands to see if it could cause problems, recompile and
test....shouldnt we all expect some kinds of problems when switching to a
new compiler?

Jun 27 '08 #16
"Serve Lau" <ni***@qinqin.comwrites:
"Eric Sosman" <es*****@ieee-dot-org.invalidschreef in bericht
news:-8******************************@comcast.com...
>Serve Lau wrote:
>>>
"Keith Thompson" <ks***@mib.orgschreef in bericht
news:ln************@nuthaus.mib.org...
The problem, I think, is that the library is a collection of pieces
developed by different people. L_tmpnam, by itself, is a reasonably
sensible name -- and by the time it was merged with the other pieces
to form what we know as the standard library, changing the name to fit
a consistent naming scheme would have broken existing code.

Since it wasnt standardized yet changing the name would not break
existing code anymore than if they took a different name from
another library. [...]

Um, er, WHAT??!

Are you claiming that no C code existed before 1989?
That ANSI decided to write a standard for a language that
had not yet been used, or had been used only for throwaway
programs of no importance?

of course not, I meant they took a name (L_tmpnam) from a library and
standardised that. You cant tell me there was no other codebase at the
time using a different name.
Why not? I don't know the detailed history, but it seems plausible
that somebody came up with the names "tmpnam" and "L_tmpnam", and that
by the type the language was standardized, nobody else had happened to
implement the same functionality using different names.
Breaking code should not have been the
issue here. Actually, why is it such a bad thing that an added macro
would break existing code, its about a compile time issue.
Suppose they named it TMPNAM_MAX and the L_tmpnam code broke because
the name doesnt exist anymore. You switch to the new compiler, your
code doesnt compile anymore, you check why and find out about the new
name. You check to see what it expands to see if it could cause
problems, recompile and test....shouldnt we all expect some kinds of
problems when switching to a new compiler?
Not if both compilers conform to the standard, but of course there was
no standard at the time.

So the committee had a choice in this case: break some existing code,
or break no existing code. The advantage of the former approach would
have been that they could change the identifier "L_tmpnam" to, um,
something else.

It's not the prettiest thing in the language, but I just can't get too
worked up about it. I can certainly understand their decision to
leave it alone rather than changing it for no good reason.

Does the name "L_tmpnam" really bother you that much?

Of course they could have gone through and cleaned up the entire
library (for someone's concept of "clean"), but that would have broken
virtually all existing code.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #17
Serve Lau wrote:
>
"Eric Sosman" <es*****@ieee-dot-org.invalidschreef in bericht
news:-8******************************@comcast.com...
>Serve Lau wrote:
>>>
"Keith Thompson" <ks***@mib.orgschreef in bericht
news:ln************@nuthaus.mib.org...
The problem, I think, is that the library is a collection of pieces
developed by different people. L_tmpnam, by itself, is a reasonably
sensible name -- and by the time it was merged with the other pieces
to form what we know as the standard library, changing the name to fit
a consistent naming scheme would have broken existing code.

Since it wasnt standardized yet changing the name would not break
existing code anymore than if they took a different name from another
library. [...]

Um, er, WHAT??!

Are you claiming that no C code existed before 1989?
That ANSI decided to write a standard for a language that
had not yet been used, or had been used only for throwaway
programs of no importance?

of course not, I meant they took a name (L_tmpnam) from a library and
standardised that. You cant tell me there was no other codebase at the
time using a different name. Breaking code should not have been the
issue here. Actually, why is it such a bad thing that an added macro
would break existing code, its about a compile time issue.
Suppose they named it TMPNAM_MAX and the L_tmpnam code broke because the
name doesnt exist anymore. You switch to the new compiler, your code
doesnt compile anymore, you check why and find out about the new name.
You check to see what it expands to see if it could cause problems,
recompile and test....shouldnt we all expect some kinds of problems when
switching to a new compiler?
The tail wags the dog. In the words of the Rationale:
"Existing code is important, existing implementations are not."
That is, the programmer should not work harder to adapt his
already-written, already-debugged, already-shipping-and-
configuration-controlled code to the whims of a new Standard,
but the Standard should bend over backwards to accommodate
the existing body of code.

Also from the Rationale, "The original X3J11 charter
clearly mandated /codifying common existing practice/," which
means the Committee had a to clear a rather high justification
hurdle whenever it proposed to adopt something different or
make an incompatible change. Somebody's dislike for a macro's
spelling just isn't enough impetus to lift a change proposal
over the bar against gratuitous meddling.

--
Eric Sosman
es*****@ieee-dot-org.invalid
Jun 27 '08 #18

"Keith Thompson" <ks***@mib.orgschreef in bericht
news:ln************@nuthaus.mib.org...
"Serve Lau" <ni***@qinqin.comwrites:
Does the name "L_tmpnam" really bother you that much?
No I dont care at all :) Too much time on my hands, will be over tomorrow :(

Jun 27 '08 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Andrew Dalke | last post by:
Here's a proposed Q&A for the FAQ based on a couple recent threads. Appropriate comments appreciated X.Y: Why doesn't Python have macros like in Lisp or Scheme? Before answering that, a...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
2
by: Pete | last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit ...) from a macro. It seems there used to be some wizard for that. However in Access 2000 it seems you have to build your...
7
by: Newbie_sw2003 | last post by:
Where should I use them? I am giving you my understandings. Please correct me if I am wrong: MACRO: e.g.:#define ref-name 99 The code is substituted by the MACRO ref-name. So no overhead....
3
by: Alexander Ulyanov | last post by:
Hi all. Is it possible to pass the whole blocks of code (possibly including " and ,) as macro parameters? I want to do something like: MACRO(FOO, "Foo", "return "Foobar";", "foo();...
8
by: lasek | last post by:
Hi...in some posts i've read...something about using macro rather then function...but difference ??. Best regards....
6
by: Takeadoe | last post by:
Dear NG, Can someone assist me with writing the little code that is needed to run an update table query each time the database is opened? From what I've been able to glean from this group, the...
5
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
0
by: =?Utf-8?B?TGV0emRvXzF0?= | last post by:
I'd like to create a Macro that will sort some raw data, apprx 20k lines, remove some lines based upon a condition in a certain column. Then copy this data into a new spreadsheet and sort the ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.