Named parameters

P

Peter Pichler

Adam Ruth said:
What is it about the name comp.lang.c that excludes my question? The
fact that there's another newsgroup that *may* be more germaine? Must
I fully grok in minute detail the "topic" of every newsgroup available
before I make a decision where to post?

What makes you think my question was about standards anyway? I ask a
question "Has there ever been talk of adding named parameters to C?"
and suddenly I'm shunted off to a standards newsgroup? My question is
plainly about C in it's most generic sense, even though an answer may
include reference to the standard.

As far as I can see, it was more a case of *recommendation* to ask the
folks in the newsgroup where you are more likely to get a competent
answer, rather than "shunting you off".

You got an answer to you question, in a direct reply to your first post,
by Jack Klein:

"It has been discussed occasionally, on the newsgroup where it is
topical, namely which discusses the past, present,
and future ANSI/ISO/IEC standard for the language. It is not really
on-topic here, where the topic is the C language as it actually is."
The response I got, "It is not really on-topic here, where the topic
is the C language as it actually is." while not being rude wasn't very
polite either. If my question really was off-topic, a
characterization I dispute, then a polite response might be, "You
would probably get a better answer in comp.std.c, we don't really
discuss those issues much here.".

You may have a point here, but believe me, no one meant to be inpolite
to you. Simply read the former as the latter, there is no reason to take
offence. BTW note the word "really" in Jack's response. It does soften it
a bit, doesn't it?

HAND,

Peter Pichler
 
P

Peter Pichler

Mark McIntyre said:
You have the groups confused:

CLC discusses Standard C, ie the language as standardised

But I must grudgingly agree with Adam: it is not really obvious from the
group's name. Not without hanging around for a few weeks and reading,
reading, reading... before first posting.
 
M

Mark McIntyre

But I must grudgingly agree with Adam:

I've no problem agreeing with the "why?" part.
it is not really obvious from the group's name.

Group names don't typically define the purpose of a group. They're a
hint, little more.
Not without hanging around for a few weeks and reading,
reading, reading... before first posting.

Which is of course what the nettiquette guidelines tell people to do!!
 
P

Peter Pichler

Mark McIntyre said:
On Fri, 31 Oct 2003 23:29:34 -0000, in comp.lang.c , "Peter Pichler"
it [the topic of clc] is not really obvious from the group's name. ....
Not without hanging around for a few weeks and reading,
reading, reading... before first posting.

Which is of course what the nettiquette guidelines tell people to do!!

You know it and I know it. But does the OP? ;-)
 
E

E. Robert Tisdale

Adam said:
Is it too off topic to discuss the topic of the newsgroup?

Hi Adam.

I see that you have already met our "off-topic cops".

The comp.lang.c newsgroup is *not* moderated.
The off-topic cops are merely expressing their personal opinions --
which they have every right to do.
Please feel free to ignore them if you do not agree.
Subscribers to comp.lang.c will respond to your question
if they feel that it is on-topic and will ignore it
if they feel that it is not.

Jack Klien, Sheldon Simms and Dan Pop have seen fit
to respond to your question and I would advise that
you pick up the discussion with them rather than
waste your time with the off-topic cops.
I also believe that Jack Klein gives sound advice.
You *should* follow-up in the comp.std.c newsgroup
but you shouldn't expect the feature to be added
to standard C until about 2009.

The best way to deal with off-topic questions is to ignore them.
The best way to deal with off-topic cops is to ignore them.
 
A

Adam Ruth

Mark McIntyre said:
I've no problem agreeing with the "why?" part.


Group names don't typically define the purpose of a group. They're a
hint, little more.


Which is of course what the nettiquette guidelines tell people to do!!

Newsgroups should have posted charters. Having to divine the topic of
a newsgroup by reading tea leaves for a few weeks is a stupid idea.

FWIW, I did read this newsgroups for several weeks before I had a
question to post. Not once did I see a message referring to the
distinction between comp.lang.c and comp.std.c and I read well over
100 postings.
 
A

Adam Ruth

Joona I Palaste said:
In the context of comp.lang.c, standard C and C are the same thing.

Let me rephrase. "It wasn't a question about the C standard, it was a
question about C."
 
A

Adam Ruth

Peter Pichler said:
As far as I can see, it was more a case of *recommendation* to ask the
folks in the newsgroup where you are more likely to get a competent
answer, rather than "shunting you off".

You got an answer to you question, in a direct reply to your first post,
by Jack Klein:

"It has been discussed occasionally, on the newsgroup where it is
topical, namely which discusses the past, present,
and future ANSI/ISO/IEC standard for the language. It is not really
on-topic here, where the topic is the C language as it actually is."


You may have a point here, but believe me, no one meant to be inpolite
to you. Simply read the former as the latter, there is no reason to take
offence. BTW note the word "really" in Jack's response. It does soften it
a bit, doesn't it?

HAND,

Peter Pichler

I wasn't actually complaining about Jack's response, taken on it's own
it was perfectly reasonable, and I did appreciate the answer.

What did bother me was that I kept seeing "off-topic" messages in the
newsgroup, yet no one has taken the effort to create a charter to put
into the FAQ. I think some people take a perverse joy in pointing out
the foibles of others, at least that's how it appears to a lurker.

What I really took exception with were the responses I got when I
pointed out that the topic of the newsgroup isn't as clear as it could
be. Some of those responses were very rude and condescending. All my
ire has been directed toward them, not Jack. He was a bit brusque,
but that's okay.
 
C

Chris Torek

["That which is topical in comp.lang.c"] is not really obvious
from the group's name.
[/QUOTE][/QUOTE]

Indeed, a short string of words and abbreviations (like "comp.lang.c"
or, to name two groups I do not read, "rec.arts.int-fiction" and
"soc.culture.magyar") is simply not *enough*.

Newsgroups should have posted charters. Having to divine the topic of
a newsgroup by reading tea leaves for a few weeks is a stupid idea.

Charters are a good idea. Comp.lang.c lacks one because it predates
charters -- this newsgroup was around when I started reading Usenet
in 1982 or 1983 or so (though under the name "net.lang.c" at the
time). It might be nice to write one, but I am not volunteering. :)
I doubt that a good charter is easy to write, and doubt even more
that any charter -- good or bad -- would be easily accepted.
FWIW, I did read this newsgroups for several weeks before I had a
question to post. Not once did I see a message referring to the
distinction between comp.lang.c and comp.std.c and I read well over
100 postings.

This group gets more than 100 postings per *day*, and has for some
years now. (I remember, back in 1983ish, when every article posted
to Usenet came over our 300 baud modems in under an hour a day most
days -- which puts the data size around 100 kbytes per day. These
days I believe the flow rates are over 100 kbytes per minute, for
a complete feed. Not that I track these things myself.)

Still, the precise distinction between comp.lang.c and comp.std.c
material is, I think, not posted as often as semimonthly. But it
is easy to gather an idea about it: simply read both groups for
several weeks. :)

In this particular case (asking about named parameters), I think it
can be topical on *both* groups. In comp.std.c one can ask whether
any future standard might include them, and whether there is any
existing work that can be referenced. In comp.lang.c one can ask
whether there is a way to at least "fake them" now -- and there is!

In particular, it is possible to obtain named parameters in C99.
You simply have to stop using ordinary function calls as if they
were ordinary function calls. Instead, pass your parameters as if
you were writing Mesa code: construct a "record" -- in C, called
a "struct" -- using the C99 "compound literal" syntax. Here is an
example function:

struct copysign_args { double value; double sign_to_copy; };

double just_like_copysign(struct copysign_args args) {
return copysign(args.value, args.sign_to_copy);
}

and a call to it that names the parameters and thus passes them
in reverse:

/* replace zog with appropriately-signed value */
zog = just_like_copysign((struct copysign_args){
.sign_to_copy = desired_sign,
.value = zog});

This method even provides default initializers for missing arguments,
provided you are happy with 0, 0.0, or NULL (as needed). :)

The drawbacks to this method are that it is ugly, and on many
machines today (but not usually the x86), it is likely to be slower
than ordinary parameter passing. (There is no fundamental reason
passing a struct by value should be any slower than passing all
its component elements by value -- it is trivial for a C compiler
to convert a call of the form f(structure) to one of the form
fprime(structure.first, structure.second, structure.third, ...,
structure.last) -- but too many ABIs have encoded silly rules about
passing structures values by secret pointer, which will force
unnecessary memory copies instead of simple register parameters.
Also, this can be one of those chicken-and-egg situations: the
calls are slow because nobody cares how fast they go, and nobody
cares how fast they go, because those programmers who do care
already know they go slow and expand out the component values, thus
there is no incentive to make them fast. Hence, they are slow,
and....)
 
A

Adam Ruth

E. Robert Tisdale said:
Hi Adam.

I see that you have already met our "off-topic cops".

The comp.lang.c newsgroup is *not* moderated.
The off-topic cops are merely expressing their personal opinions --
which they have every right to do.
Please feel free to ignore them if you do not agree.
Subscribers to comp.lang.c will respond to your question
if they feel that it is on-topic and will ignore it
if they feel that it is not.

Jack Klien, Sheldon Simms and Dan Pop have seen fit
to respond to your question and I would advise that
you pick up the discussion with them rather than
waste your time with the off-topic cops.
I also believe that Jack Klein gives sound advice.
You *should* follow-up in the comp.std.c newsgroup
but you shouldn't expect the feature to be added
to standard C until about 2009.

The best way to deal with off-topic questions is to ignore them.
The best way to deal with off-topic cops is to ignore them.

Thank you for the sound advice. I won't continue to feed this
ungainly creation of mine... to paraphrase Tevya, "It is dead to me".
 
P

Peter Pichler

Chris Torek said:
Indeed, a short string of words and abbreviations (like "comp.lang.c"
or, to name two groups I do not read, "rec.arts.int-fiction" and
"soc.culture.magyar") is simply not *enough*.

In fact, soc.culture.magyar is descriptive enough to those who can speak
(both English and) Magyar, i.e. Hungarian :)
This group gets more than 100 postings per *day*

Indeed. I find it really puzzling where you guys find all the time to
answer 200 odd posts every day, often within minutes. I am really
impressed.
 
D

Dave Vandervies

Peter Pichler said:
Indeed. I find it really puzzling where you guys find all the time to
answer 200 odd posts every day, often within minutes. I am really
impressed.

I can't speak for others, but for me it's usually five or ten minutes
at a time.

With a few people, preferably distributed between a few different time
zones, doing that, we can make it look like we have a lot more time than
we really do.


dave
 
C

Chris Torek

In fact, soc.culture.magyar is descriptive enough to those who can speak
(both English and) Magyar, i.e. Hungarian :)

I would assume as much -- but from the name alone, I cannot tell
whether this is "Hungarian culture in general" or "things specific
to those who speak Magyar". For example, would a discussion of
the cultural effects of Mongolian raids on the area that is now
part of Hungary be topical?
Indeed. I find it really puzzling where you guys find all the time to
answer 200 odd posts every day, often within minutes. I am really
impressed.

The odder the better :) In any case, my answer rate goes up rather
steeply on weekends, these days.
 
J

James Hu

I see the "this is off-topic" comment enough in this group to wonder
why that hasn't been put in the FAQ. Perhaps the name of the
newsgroup should change to be a bit more explicit about its topic.

The C-faq doesn't address topicality directly as an FAQ, but it
does mention the comp.lang.c topicality litmus test in a single
sentence in the fourth paragraph to the answer of question 19.1:

"Since comp.lang.c is oriented towards those topics that the C
language has defined support for, you will usually get better
answers to other questions by referring to a system-specific
newsgroup such as comp.unix.questions or comp.os.msdos.programmer,
and to the FAQ lists for these groups."

This sentence was provided in the context of character-at-a-time
input, but it does clearly indicate what sorts of topics are
discussed in comp.lang.c.

[ Steve, if you are reading this, do you think a question regarding
comp.lang.c topicality warrants its own FAQ? ]

Your question:

This is asking if extending C to support named parameters has
ever been discussed. Jack's response was dead on. This is
a question about changing the existing C standard.

It sometimes happens (perhaps less often than it should) that an
off-topic question will be adjusted to become on-topic. Such an
occurrence has happened to your question. Chris Torek started a
new thread adjusting the question to be:

Is there a way in C to write programs as if it did have named
parameters?

And (as usual) he provides an excellent answer.

-- James
 
M

Mark McIntyre

You *assume* it's a question about chaging the standard.

Adam, I'm not trying to be difficult but:

Question "has anyone considered adding named parameters to C?"

C doesn't support named parameters. To add them would require a change
to the Standard. QED.
 
M

Mark McIntyre

Newsgroups should have posted charters.

Not all groups have charters. Some, such as CLC, predate the charter
idea, being in usenet terms prehistoric.
Having to divine the topic of
a newsgroup by reading tea leaves for a few weeks is a stupid idea.

There's a FAQ, and a regular "welcome" message, posted roughly every
couple of weeks if Billy remembers. The latter mentions the topic, the
former should make it pretty clear.
FWIW, I did read this newsgroups for several weeks before I had a
question to post. Not once did I see a message referring to the
distinction between comp.lang.c and comp.std.c and I read well over
100 postings.

Grin. If you only read 100 postings, you didn't read for several weeks
- I read around 200 posts per DAY here.

And in any events, nobody flamed you for posting in the wrong place -
people merely redirected you. If you take umbrage at that, expect long
threads involving flames !!
 
M

Mark McIntyre

Let me rephrase. "It wasn't a question about the C standard, it was a
question about C."

Okay, let me rephrase the answer. You want to ask a question about
changing C so that it includes named parameters. Thats offtopic in CLC
which discusses C as it /currently/ exists (including historical
implementations). Your idea involves changing the Standard, which is
discussed over in CSC, or it involves implementation-specific
extensions, which are discussed in the relevant implementation
specific group. .
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top