Problem with switch expression

B

Ben Bacarisse

Nick Keighley said:
On 1 July, 21:41, Ben Bacarisse <[email protected]> wrote:

yes

RFC 2119
"SHOULD This word, or the adjective "RECOMMENDED", mean that there
may exist valid reasons in particular circumstances to ignore a
particular item, but the full implications must be understood and
carefully weighed before choosing a different course."

I am dubious about the value of quoting an unrelated standard. Granted
it is an example of "should" as a recommendation, but it is a highly
specific one that was probably never intended by the OP. What is more,
RFC 2119 uses MUST and SHOULD to make the distinction (and they MUST be
in upper case to indicate their special meaning).

English is subtle, and the OED entry for shall and should runs to many
pages but the nub of this matter is explained towards the end:

*** The past tense should with modal function.

As with other auxiliaries, the pa. tense (orig. subjunctive) of shall
is often used to express, not a reference to past time, but a modal
qualification of the notion expressed by the present tense.

The examples show how using should rather shall is used to denote
conditionality, expectation and hypothesis. My own example: "you should
go to the ball" is in no way the past tense of "you shall go to the
ball".

[I promise to stop now, honest. "We should be so lucky!"]

<snip>
 
T

Tim Rentsch

Ben Bacarisse said:
I think the evidence points the other way. By far the most frequent use
of "should" in normative text of the standard (C99, at least) is in
"Recommended Practice" sections. It seems to be describing QOI rather
than mandatory behaviour (if it's mandatory, why is it only
recommended?). "Shall" is more often used for obligation while "should"
seems to be more frequently used for a strong suggestion.

One usage puzzles me. Does this program exhibit undefined behaviour?

#include <stdio.h>

int count = 0;

FILE *count_use(void) { ++count; return stdout; }

int main(void)
{
putc('\n', count_use());
printf("%d\n", count);
return 0;
}

It violates a "should" but I don't know anymore if that is a mandatory
"should" or a recommendation "should"!

Presuming you're referring to 7.19.7.8p2, I'm curious to know what
it is about the passage that causes you puzzlement. I mean this
as just a simple question, no expectations implied; eg, vague
or nebulous reasons are perfectly okay.
 
B

Ben Bacarisse

Tim Rentsch said:
Presuming you're referring to 7.19.7.8p2, I'm curious to know what
it is about the passage that causes you puzzlement. I mean this
as just a simple question, no expectations implied; eg, vague
or nebulous reasons are perfectly okay.

Until this thread, I had no trouble with it. With the suggestion that
"should" might simply be used as another tense for "shall" (i.e.
something that can't be violated without UB[1]) the section took on a
new meaning.

Lawrence Jones has clarified: should is standardese for a
recommendation not a requirement. The standard English meaning applies.

By the way, I am not a fan of emoticons so I try to indicate a degree of
levity with exclamation points. I was not being 100% serious.

[1] No one actually said this but it was floated and some participants
seemed to think is carried a sense of obligation.
 
T

Tim Rentsch

Ben Bacarisse said:
Tim Rentsch said:
Presuming you're referring to 7.19.7.8p2, I'm curious to know what
it is about the passage that causes you puzzlement. I mean this
as just a simple question, no expectations implied; eg, vague
or nebulous reasons are perfectly okay.

Until this thread, I had no trouble with it. With the suggestion that
"should" might simply be used as another tense for "shall" (i.e.
something that can't be violated without UB[1]) the section took on a
new meaning.

Lawrence Jones has clarified: should is standardese for a
recommendation not a requirement. The standard English meaning applies.

That was my understanding all along, which is why I was curious.
I do think there's a difference in tone between "should"s
directed at implementors and "should"s directed at developers:
in the first case they sound like recommendations, in the
second case they sound more like admonitions. I believe the
intended meaning is the same in the two cases, but if the
tone is different in different cases I can see how that might
make people wonder if there is something more going on there.
By the way, I am not a fan of emoticons so I try to indicate a degree of
levity with exclamation points. I was not being 100% serious.

[1] No one actually said this but it was floated and some participants
seemed to think is carried a sense of obligation.

I see! Thank you for the clarification.
 
B

BruceS

Please don't. It's bound to put clc in high gudgeon.

Is it just a fluke that this hasn't netted complaints? It's become a
gaff, so we should scale it back and say "Fin".
 

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

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top