comp.lang.c - 25 new messages in 6 topics - digest
comp.lang.c
http://groups.google.com/group/comp.lang.c?hl=en
Today's topics:
* how to get out of double for loops? - 9 messages, 5 authors
http://groups.google.com/group/comp.lang.c/t/535cb24e8f02aec3?hl=en
* Stylistic questions on UNIX C coding. - 8 messages, 5 authors
http://groups.google.com/group/comp.lang.c/t/51d2b24a60d73f18?hl=en
* Test for function existence? - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.c/t/5e44bad5942760a6?hl=en
* efficiency question - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/ac42317db6371cec?hl=en
* GET THE SIZE of struct in the PREPROCESSOR - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/5868afedbbea3260?hl=en
* I hate niggers - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/0acf23e382a13782?hl=en
==============================================================================
TOPIC: how to get out of double for loops?
http://groups.google.com/group/comp.lang.c/t/535cb24e8f02aec3?hl=en
==============================================================================
== 1 of 9 ==
Date: Fri, Mar 5 2010 7:29 am
From: Fred
On Mar 5, 1:04 am, MBALOVER <mbalov...@gmail.com> wrote:
> Hi all,
>
> I want to quit of both "for" loop whenever I find x[i][j]=1;
>
> Do you know how to do it?
>
> Right now, I am using the following code but I believe there should be
> a much more efficient way for this task.
>
> flag=0;
> for (i=0;i<H;i++)
> {
> for (j=0;j<H;j++)
> if (x[i][j]==1)
> {
> flag=1;
> break;
> }
> if( flag)
> break
>
> }
>
int findOne(int**x, int H, int *ip, int *jp) {
int i,j;
for (i=0;i<H;i++) {
for (j=0;j<H;j++) {
if (x[i][j]==1) {
*ip = i;
*jp = j;
return 1;
}
}
}
return 0;
}
--
Fred K
== 2 of 9 ==
Date: Fri, Mar 5 2010 7:43 am
From: cri@tiac.net (Richard Harter)
On Fri, 5 Mar 2010 07:05:31 -0800 (PST), Tom St Denis
<tom@iahu.ca> wrote:
>On Mar 5, 9:01=A0am, Mark Bluemel <mark.blue...@googlemail.com> wrote:
>> What makes you think my allergy comes from the article?
>>
>> I've been programming in various languages for over 30 years, and I
>> found by experience very early on that goto was rarely useful and
>> could be, as the man said, harmful. I can't remember the last time I
>> used one.
>
>As someone pointed out exceptions in Java are really just goto,
>consider the two blocks
>
> // statements that allocate ram/resources/etc
> if (something() !=3D OK) { goto error; }
> if (somethingelse() !=3D OK) { goto error; }
> // ... and so on
> return OK;
>error:
> // clean up code
> return BAD;
>
>
>Then compare that to
>
>try {
> something();
> somethingelse();
>} catch (exception e) {
> // clean up
> return BAD;
>}
>return OK;
>
>How are they any diff [other than presentation]? "anti-goto" rules
>are fairly stupid as any strict "anti-whatever" rule kinda omits the
>possibility for ... exceptions to the rule ... :-)
They work much the same, but the presentation is important. The
try/catch construction has strict limitations; the goto error
construction does not. My view is that java is meant for
drinking and never for coding. In some languages with exceptions
you can nest try/catch blocks and unwinding will be taken care of
automatically. This isn't true when using gotos for error
handling.
Incidentally, how are with simulating blocks with
do {...} while (0);
In your example you could write:
do {
if ((result = something()) == BAD) break;
if ((result = somethingelse()) == BAD) break;
} while(0);
if (result == BAD) {
/* clean up code */
} else {
/* Action code */
}
return result;
For some reason, many people get uptight about using blocks (I'm
using the term as a block of code that is not in a loop but can
be escaped from.) Oddly enough they are have no problem with
using a function as a block.
How do you stand on this issue?
>
>I'm all against backwards goto in general [that's what continue is
>for]. But forward goto's are perfectly fine provided they're used
>when needed [exception handling and exiting a deeply nested loop being
>two prime examples].
>
>Tom
Richard Harter, cri@tiac.net
http://home.tiac.net/~cri, http://www.varinoma.com
It's not much to ask of the universe that it be fair;
it's not much to ask but it just doesn't happen.
== 3 of 9 ==
Date: Fri, Mar 5 2010 7:50 am
From: cri@tiac.net (Richard Harter)
On Fri, 05 Mar 2010 15:28:18 +0000, Ben Bacarisse
<ben.usenet@bsb.me.uk> wrote:
Sniff. You omitted the smiley.
Richard Harter, cri@tiac.net
http://home.tiac.net/~cri, http://www.varinoma.com
It's not much to ask of the universe that it be fair;
it's not much to ask but it just doesn't happen.
== 4 of 9 ==
Date: Fri, Mar 5 2010 8:22 am
From: Ben Bacarisse
cri@tiac.net (Richard Harter) writes:
> On Fri, 05 Mar 2010 15:28:18 +0000, Ben Bacarisse
> <ben.usenet@bsb.me.uk> wrote:
>
> Sniff. You omitted the smiley.
I am not good with smileys. I have tried, recently, to inject a few
in to my posts but I am not entirely happy with the results :-(
As a result, I probably come over as serious and ponderous about
things that I take with a pinch of salt. Sorry if that is the case.
To keep things light and topical, here is another single loop version
to ponder the merits of:
for (i = 0; i < H*H && x[i/H][i%H] != 1; i++);
I rather like it :-)
--
Ben.
== 5 of 9 ==
Date: Fri, Mar 5 2010 8:43 am
From: cri@tiac.net (Richard Harter)
On Fri, 05 Mar 2010 16:22:51 +0000, Ben Bacarisse
<ben.usenet@bsb.me.uk> wrote:
>cri@tiac.net (Richard Harter) writes:
>
>> On Fri, 05 Mar 2010 15:28:18 +0000, Ben Bacarisse
>> <ben.usenet@bsb.me.uk> wrote:
>>
>> Sniff. You omitted the smiley.
>
>I am not good with smileys. I have tried, recently, to inject a few
>in to my posts but I am not entirely happy with the results :-(
>
>As a result, I probably come over as serious and ponderous about
>things that I take with a pinch of salt. Sorry if that is the case.
>
>To keep things light and topical, here is another single loop version
>to ponder the merits of:
>
> for (i = 0; i < H*H && x[i/H][i%H] != 1; i++);
>
>I rather like it :-)
And well you should. :-)
You could make it more efficient (if I have the syntax right)
with
int **y; /* use appropriate type */
for (i = 0, y = (int **)x; i <HH && y[i] != 1; i++);
j = i%H; i /= H;
There is no end of good solutions. :-)
Richard Harter, cri@tiac.net
http://home.tiac.net/~cri, http://www.varinoma.com
It's not much to ask of the universe that it be fair;
it's not much to ask but it just doesn't happen.
== 6 of 9 ==
Date: Fri, Mar 5 2010 8:47 am
From: Eric Sosman
On 3/5/2010 8:17 AM, Rob Kendrick wrote:
> On Fri, 5 Mar 2010 04:25:25 -0800 (PST)
> Mark Bluemel<mark.bluemel@googlemail.com> wrote:
>
>> I'm allergic to gotos - if I managed to write COBOL without goto for
>> many years, I think I can manage to write C without goto. (My primary
>> language these days is Java, which doesn't even have goto).
>
> What do you think break is, if not another word for goto?
It's "break," of course.
If you equate every transfer of control with "goto," you are
confusing low-level implementation techniques with the language
structures they implement. Put it this way: If you think "break"
is "goto" (and I imagine you think of "continue" the same way),
what do you think of "return?" Of the function call operator?
Of "while" and "for" and "do" and "switch" and "if" and "else?"
Of the "?:" operator, particularly when the second and/or third
operands have side-effects? All of these cause control transfers,
sometimes more than one; are they therefore all "goto?"
--
Eric Sosman
esosman@ieee-dot-org.invalid
== 7 of 9 ==
Date: Fri, Mar 5 2010 8:59 am
From: Ben Bacarisse
cri@tiac.net (Richard Harter) writes:
> On Fri, 05 Mar 2010 16:22:51 +0000, Ben Bacarisse
> <ben.usenet@bsb.me.uk> wrote:
<snip>
>>To keep things light and topical, here is another single loop version
>>to ponder the merits of:
>>
>> for (i = 0; i < H*H && x[i/H][i%H] != 1; i++);
>>
>>I rather like it :-)
>
> And well you should. :-)
>
> You could make it more efficient (if I have the syntax right)
> with
>
> int **y; /* use appropriate type */
>
> for (i = 0, y = (int **)x; i <HH && y[i] != 1; i++);
> j = i%H; i /= H;
I think you intended to treat x as a 1-dimensional array, yes? If so,
you wanted to write:
int *y;
for (i = 0, y = x[0]; i < H*H && y[i] != 1; i++);
j = i%H; i /= H;
but that brings up another c.l.c FAP[1]: is indexing y from y[H]
onwards really permitted?
[1] Frequently Argued Point.
--
Ben.
== 8 of 9 ==
Date: Fri, Mar 5 2010 9:00 am
From: Eric Sosman
On 3/5/2010 10:05 AM, Tom St Denis wrote:
>
> As someone pointed out exceptions in Java are really just goto,
>[...]
One significant difference is that `goto' specifies the
target of the control transfer. Upon seeing `goto label' you
can hunt for `label' and know where execution will resume. But
when you see `throw new HissyFit()' all you know is that you're
going somewhere else. Where? Well, um, "it depends."
Another difference is that with `goto label', when control
arrives at `label' there's no additional information. "How did
I get here?" is unknown, unless the program is amenable to a
static analysis that reveals there's only one point of departure.
An exception carries a lot of information about its circumstances,
and that information is available to -- and manipulable by -- the
code at the `catch' point.
It seems to me that "someone" has oversimplified.
--
Eric Sosman
esosman@ieee-dot-org.invalid
== 9 of 9 ==
Date: Fri, Mar 5 2010 9:37 am
From: Richard Heathfield
Ben Bacarisse wrote:
<snip>
> To keep things light and topical, here is another single loop version
> to ponder the merits of:
>
> for (i = 0; i < H*H && x[i/H][i%H] != 1; i++);
This reminds me of a solution I once wrote to an exercise question that
used to bring quite a few panicking newbies to this group. The idea was
to write a program that could generate a diamond-shaped border, like this:
*
* *
* *
* *
*
to a runtime-specified arbitrary (but reasonable) size. My solution used
a single loop. Here it is (and, for the impatient, I've added a
preprocessed version at the end of this article):
#include <stdlib.h>
#include <stdio.h>
#define O int
#define B main
#define F char
#define U if
#define S atoi
#define C for
#define A putchar
#define T '*'
#define E ' '
#define D '\n'
#define c ==
#define o =
#define d ++
#define e return
#define r ||
O
B (
O k
, F
* v
[ ]
) {
O i
, j = 9
; U ( k > 1
) { j = S
( v [ 1
] ) ; }
U ( ! (
j > 0 )
) { j =
5 ; } U ( (
j & 1 ) c 0 ) {
d j ; } C (
i = 0 ;
i < j * j
; A ( i / j
c ( 3 * j
) / 2 -
( i % j + 1
) r i / j c j /
2 - i % j r
i / j c
j / 2 +
i % j r
i / j c
i % j -
j / 2 ? T
: E ) , i d
, i % j
c 0
? A
( D
) :
0 )
; e
0 ;
}
Here is the post-preprocessor version:
#include <stdlib.h>
#include <stdio.h>
int main(int k, char *v[]) { int i, j = 9; if(k > 1) { j = atoi(v[1]); }
if(!(j > 0)) { j = 5; } if((j & 1) == 0) { ++j; } for(i = 0; i < j * j;
putchar(i / j == (3 * j) / 2 - (i % j + 1) || i / j == j / 2 - i % j ||
i / j == j / 2 + i % j || i / j == i % j - j / 2 ? '*' : ' '), i++, i %
j == 0 ? putchar('\n') : 0) ; return 0; }
<gratuitous smiley snipped, thou bounder>
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999
Sig line vacant - apply within
==============================================================================
TOPIC: Stylistic questions on UNIX C coding.
http://groups.google.com/group/comp.lang.c/t/51d2b24a60d73f18?hl=en
==============================================================================
== 1 of 8 ==
Date: Fri, Mar 5 2010 8:04 am
From: Richard Heathfield
Ersek, Laszlo wrote:
> In article <OIidndrfAtccKg3WnZ2dnUVZ8sCdnZ2d@bt.com>,
> Richard Heathfield <rjh@see.sig.invalid> writes:
>
>> Seebs wrote:
>>
>> <snip>
>>
>>> When I see "if (x != y)" in C, I
>>> unconsciously perceive it to be the case that x could vary and y couldn't.
>> Why?
>
> Because he pronounces it as "x is not equal to y", and the subject of
> that sentence is "x". "x" is the actor, the variable that is acting. "y"
> is part of the prepositional phrase, it is static.
This is C we're discussing, not English. It is folly to pretend that the
rules of English apply to C.
>>> Consider:
>>> for (i = 0; i < 10; ++i)
>>>
>>> Why do we write "i < 10" rather than "10 >= i"?
>> Good question.
>
> .... It's either me, or now two of you not noticing (or ignoring) that
> "10 == i" satisfies the second but not the first.
Ignoring. Probably a minor thinko on his part, no big deal.
>>> Because i's the one that
>>> varies, so "i is less than ten" is more idiomatic than "ten is greater than
>>> or equal to i".
>> Why?
>
> Because programmatically, "i" changes over time, 10 does not,
That doesn't answer the question.
> and when
> one reads out loud the controlling expression in English, the subject of
> that sentence ("the actor") should be the entity that is acting.
Again, this is C we're discussing, not English.
>>> Now consider:
>>> for (i = 0; i < max; ++i)
>>>
>>> even though "max" may vary over time, the assumption is that, for this loop,
>>> i changes and max doesn't.
>> Why?
>
> Because when read out loud, "i" is the subject.
Again, your comment would only be relevant if this were English, which
it isn't.
<snip>
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999
Sig line vacant - apply within
== 2 of 8 ==
Date: Fri, Mar 5 2010 8:30 am
From: Keith Thompson
Tim Rentsch <txr@x-alumni2.alumni.caltech.edu> writes:
> Keith Thompson <kst-u@mib.org> writes:
>
>> Ian Collins <ian-news@hotmail.com> writes:
>>> Tim Rentsch wrote:
>>>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>>>> Richard Heathfield <rjh@see.sig.invalid> writes:
>>>>>> Anand Hariharan wrote:
>>>>>> <snip>
>>>>>>> Haven't seen anyone point this out:
>>>>>>>
>>>>>>> Rather than -
>>>>>>>
>>>>>>> #define MAXNUMFILES 1024
>>>>>>>
>>>>>>> - prefer -
>>>>>>>
>>>>>>> const int MaxNumFiles = 1024;
>>>>>>>
>>>>>>>
>>>>>>> That way your preprocessor won't do as much damage.
>>>>>> Fine in C99, I think, but an issue in C90 if he's using it to define
>>>>>> an array size.
>>>>> It's a problem in C99 too, if the array is defined at file scope or it
>>>>> has internal linkage. There are other reasons why it's not a great
>>>>> idea in C99. They stem from the fact that MaxNumFiles is not
>>>>> permitted as part of a constant expression. [snip elaboration]
>>>>
>>>> Minor clarification -- MaxNumFiles is _permitted_ as part of a constant
>>>> expression, albeit an implementation-specific constant expression;
>>>> it just isn't _required_ to be a portable constant expression.
>>>
>>> What? You could say just about any nonsense is permitted as part of
>>> an implementation-specific expression.
>>>
>>> That doesn't alter that fact that in C90 or C99, MaxNumFiles is not
>>> permitted as part of a constant expression.
>>
>> I think Tim is referring to C99 6.6p10:
>>
>> An implementation may accept other forms of constant expressions.
>
> Quite so.
>
>> (I just noticed that this doesn't use the term
>> "implementation-defined" implying, I think, that an implementation
>> can accept other forms of constant expressions but isn't required
>> to document them.)
>
> My belief is that such forms of constant expressions still count
> as language extensions. If they are they must be documented,
> because extensions are required to be documented.
Then the only purpose of 6.6p10 is to permit implementations *not* to
issue diagnostics on the use of "other forms of constant expressions".
For example:
const int x = 42;
switch (...) {
case x:
...
Normally "case x:" is a constraint violation, but if the
implementation accepts it under 6.6p10, no diagnostic is required.
Plausible, but I'm not 100% convinced either that this is what the
standard says or that it's a good idea. For one thing, the lack
of a diagnostic would make it more difficult to write portable code.
>> My understanding is that code that uses extensions in general (as
>> permitted by C99 4p6) still require diagnostics if the code violates a
>> constraint, but code that uses "other forms of constant expressions"
>> does not.
>
> Yes, diagnostics are still required for using any extensions that
> is a syntax error or a constraint violation, but not not if they
> don't, and that also includes "other forms of constant expressions".
> (In other words my assessment here agrees with Keith's.)
I'm not sure mine does. Another reasonable interpretation of 6.6p10
is that it permits implementations to support other forms of constants;
for example:
const int x = 0b10_1010;
/* 0b denotes binary, underscores are ignored */
This is obviously a syntax error, requiring a diagnostic, for an
implementation that doesn't support it. Can an implementation not
emit a diagnostic and point to 6.6p10 to justify it? Or must it
issue a diagnostic and make it an extension under 4p6?
I'd be happy to accept the committee's intent here if I knew what
it was.
[snip]
>> And why is that permission there in the first place? What benefit
>> does it really provide beyond the existing permission to provide
>> extensions?
>
> It seems clear that the point is to allow additional forms of
> constant expression without absolutely insisting on generating a
> diagnostic; in other words to leave the question of diagnostics
> up to the discretion of the implementation. Without 6.6p10 any
> other forms of constant expression wouldn't meet the Standard's
> definition, and if used in places that need constant expressions
> would cause constraint violations.
Personally, I'd prefer to drop the permission in 6.6p10 and allow
other forms of constant expression, like any other extension, under
4p6. A conforming implementation would have to issue a diagnostic
for anything that would be a constraint violation or syntax error
without the extension. If you don't want the diagnostic, invoke
the compiler in a not-quite-conforming mode.
--
Keith Thompson (The_Other_Keith) kst-u@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"
== 3 of 8 ==
Date: Fri, Mar 5 2010 9:09 am
From: lacos@ludens.elte.hu (Ersek, Laszlo)
In article
<0.49be2e2b11253f6112d8.20100305151304GMT.87vddaajk0.fsf@bsb.me.uk>,
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> lacos@ludens.elte.hu (Ersek, Laszlo) writes:
>
>> In article <OIidndrfAtccKg3WnZ2dnUVZ8sCdnZ2d@bt.com>,
>> Richard Heathfield <rjh@see.sig.invalid> writes:
>>
>>> Seebs wrote:
>>>> for (i = 0; i < 10; ++i)
>>>>
>>>> Why do we write "i < 10" rather than "10 >= i"?
>> "10 == i" satisfies the second but not the first.
> Either way, it's not really at the heart of the question unless you
> think the switch *caused* the typo.
Yes, I thought (and think) that that was not unpossible. If my memory
serves, both Keith and Seebs have pointed out that they need to reorder
reverse-ordered relational operators in their heads (sorry if I'm making
this up now) or that it causes extra mental load or something to that
effect. So the typo may be related to the reversing process.
Cheers,
lacos
== 4 of 8 ==
Date: Fri, Mar 5 2010 9:13 am
From: lacos@ludens.elte.hu (Ersek, Laszlo)
In article <4JydnbCdGNgatgzWnZ2dnUVZ7rydnZ2d@bt.com>,
Richard Heathfield <rjh@see.sig.invalid> writes:
> Ersek, Laszlo wrote:
>> Because when read out loud, "i" is the subject.
>
> Again, your comment would only be relevant if this were English, which
> it isn't.
Exactly -- I'm a staunch member of the "7 == x" camp. I just tried to
explain why, as I perceive, Seebs thinks what he thinks. (Sorry if this
qualifies as bad etiquette.)
Cheers,
lacos
== 5 of 8 ==
Date: Fri, Mar 5 2010 9:22 am
From: Tim Streater
On 05/03/2010 07:18, Richard Heathfield wrote:
> [Interesting bunch of crossposts!]
>
> Keith Thompson wrote:
>> Tim Streater <timstreater@waitrose.com> writes:
>>> On 04/03/2010 20:35, Jonathan de Boyne Pollard wrote:
>>>>> And "x == 7" is much more readable than "7 == x".
>>>>>
>>>>> At least, for English speakers it is. I don't know; maybe there are
>>>>> languages in which saying "if x is equal to y" implies that x is the
>>>>> constant and y is the variable.
>>>>>
>>>> Nonsense. This is nothing to do with speaking English.
>
> Correct. C and English are different languages, with different purposes
> and different idioms.
>
>>>> You only find
>>>> the ordering natural in C for purely circular reasons: It's natural to
>>>> (most) C programmers because that's how most C language code that they
>>>> have read is written. (And it's written that way because "It's
>>>> natural.") Nothing more, and nothing as a result of the English
>>>> language.
>
> Right.
>
>>> Rubbish. You don't say "if that chicken is an animal then I'll eat
>>> it", you say "If that animal is a chicken then I'll eat it".
>
> Tim, those two sentences don't mean the same thing. We're discussing
> value equality, not (as Keith nicely puts it) set membership. Closer
> example: "if that chicken's name is Edwina, I'll eat it" vs "if Edwina
> is that chicken's name, I'll eat it".
I think my example was not, in any case, a very good one. Where I'm
coming from is, I believe, this: an "if" statement is to be used where
one wants to test something. If I see a statement that starts, e.g.:
if (7==x ...
then immediately my brain is saying: "Hold on, why am I testing 7? I
know what 7 is equal to - it's equal to 7! So what's the "if" statement
for?". If I want to know what *x* is equal to, that's a different story,
and a valid question, because x is a variable. 7 is not.
--
Tim
"That the freedom of speech and debates or proceedings in Parliament
ought not to be impeached or questioned in any court or place out of
Parliament"
Bill of Rights 1689
== 6 of 8 ==
Date: Fri, Mar 5 2010 9:31 am
From: Tim Streater
On 05/03/2010 16:04, Richard Heathfield wrote:
> Ersek, Laszlo wrote:
>> In article <OIidndrfAtccKg3WnZ2dnUVZ8sCdnZ2d@bt.com>,
>> Richard Heathfield <rjh@see.sig.invalid> writes:
>>
>>> Seebs wrote:
>>>
>>> <snip>
>>>
>>>> When I see "if (x != y)" in C, I
>>>> unconsciously perceive it to be the case that x could vary and y
>>>> couldn't.
>>> Why?
>>
>> Because he pronounces it as "x is not equal to y", and the subject of
>> that sentence is "x". "x" is the actor, the variable that is acting. "y"
>> is part of the prepositional phrase, it is static.
>
> This is C we're discussing, not English. It is folly to pretend that the
> rules of English apply to C.
But Richard, you have to read the code in order to interpret it mentally
and decide whether it's correct or not, or how to amend it. I gave up on
Forth, Lisp, and regexps for just this reason.
--
Tim
"That the freedom of speech and debates or proceedings in Parliament
ought not to be impeached or questioned in any court or place out of
Parliament"
Bill of Rights 1689
== 7 of 8 ==
Date: Fri, Mar 5 2010 9:40 am
From: Richard Heathfield
Ersek, Laszlo wrote:
> In article <4JydnbCdGNgatgzWnZ2dnUVZ7rydnZ2d@bt.com>,
> Richard Heathfield <rjh@see.sig.invalid> writes:
>
>> Ersek, Laszlo wrote:
>
>>> Because when read out loud, "i" is the subject.
>> Again, your comment would only be relevant if this were English, which
>> it isn't.
>
> Exactly -- I'm a staunch member of the "7 == x" camp. I just tried to
> explain why, as I perceive, Seebs thinks what he thinks. (Sorry if this
> qualifies as bad etiquette.)
I misinterpreted your reply, and misreplied accordingly. The
responsibility for bad etiquette in this subthread, if bad etiquette has
indeed transpired, is entirely mine.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999
Sig line vacant - apply within
== 8 of 8 ==
Date: Fri, Mar 5 2010 9:01 am
From: William Ahern
In comp.lang.c Keith Thompson <kst-u@mib.org> wrote:
> William Ahern <william@wilbur.25thandClement.com> writes:
> > In comp.unix.programmer Ike Naar <ike@localhost.claranet.nl> wrote:
> [...]
> >> Using ``='' for something other than equality was, in my opinion, the
> >> most unfortunate design decision in the design of C.
> >
> > But it does mean equality. In fact, it commands it.
>
> Not for volatile objects or NaNs.
The implementation may not comply, and by the standard rightly so. But "="
is nonetheless a command by the programmer to make the object equal. "="
isn't a cognate w/ the mathemetical symbol. It's merely overloaded. C is an
imperative language, afterall.
==============================================================================
TOPIC: Test for function existence?
http://groups.google.com/group/comp.lang.c/t/5e44bad5942760a6?hl=en
==============================================================================
== 1 of 4 ==
Date: Fri, Mar 5 2010 8:27 am
From: David Mathog
Is there a standard, or at least common, method for testing for the
existence of a function in a particular compiler implementation that
does not depend upon the definition of an associated preprocessor
variable? For instance chown() is often not implemented on some
platforms, so what I'm looking for is an expression like:
#if MAGIC_HERE(chown)
/* use chown() somehow */
#else
/* do nothing */
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home