Thursday, April 15, 2010

comp.lang.c - 25 new messages in 10 topics - digest

comp.lang.c
http://groups.google.com/group/comp.lang.c?hl=en

comp.lang.c@googlegroups.com

Today's topics:

* Write C++ wrappers of C code automatically - 4 messages, 4 authors
http://groups.google.com/group/comp.lang.c/t/00adb8e62ab53f38?hl=en
* Is this a correct implementation of strstr ? - 5 messages, 4 authors
http://groups.google.com/group/comp.lang.c/t/e69b0f022e4c27e1?hl=en
* errors and casting - 8 messages, 5 authors
http://groups.google.com/group/comp.lang.c/t/eee9a73d267c1066?hl=en
* Bill Cunningham and sockets for the past six years - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/1d16924d271398d9?hl=en
* how to implement logical equivalence (==) or negation (!) using only binary
operators - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/996f7df08a4c8123?hl=en
* Virus "warnings" - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/0e5727bb64e230a3?hl=en
* Dweebach about void main() - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/383e6d5a95dc3f75?hl=en
* seebs/schildt - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/0c84debf9a4f144b?hl=en
* Sad state of standards-conformance and consistency of compilers - 2 messages,
2 authors
http://groups.google.com/group/comp.lang.c/t/8e4236bf3f19c661?hl=en
* OT Re: Emily Postnews - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/fee08dfa5e4cbaaa?hl=en

==============================================================================
TOPIC: Write C++ wrappers of C code automatically
http://groups.google.com/group/comp.lang.c/t/00adb8e62ab53f38?hl=en
==============================================================================

== 1 of 4 ==
Date: Thurs, Apr 15 2010 12:17 am
From: Joakim Hove


> Just use the library as is. Wrapping it in C++ code doesn't do much but
> change the syntax and that shouldn't matter.– Skjul sitert tekst –

I realize that; myself I am perfectly using the C code, however there
are some people in my organisation with a love/hate relationship with
C/C++ and I am trying to cater to their "needs". So - it is actually
the syntax change (and some maintainance overhead....) I am after.

Regards

Joakim

== 2 of 4 ==
Date: Thurs, Apr 15 2010 1:05 am
From: Michael Doubez


On 15 avr, 09:17, Joakim Hove <joakim.h...@gmail.com> wrote:
> > Just use the library as is. Wrapping it in C++ code doesn't do much but
> > change the syntax and that shouldn't matter.

It is not totally true, automatic call of alloc/free function is IMO
already an improvement.

>– Skjul sitert tekst –
>
> I realize that; myself I am perfectly using the C code, however there
> are some people in my organisation with a love/hate relationship with
> C/C++ and I am trying to cater to their "needs". So - it is actually
> the syntax change (and some maintainance overhead....) I am after.

A script parsing the headers and generating c++ class could get you a
long way (eventually with meta-informations).

--
Michael


== 3 of 4 ==
Date: Thurs, Apr 15 2010 2:33 am
From: "Ersek, Laszlo"


On Thu, 15 Apr 2010, Michael Doubez wrote:

> On 15 avr, 09:17, Joakim Hove <joakim.h...@gmail.com> wrote:
>>> Just use the library as is. Wrapping it in C++ code doesn't do much but
>>> change the syntax and that shouldn't matter.
>
> It is not totally true, automatic call of alloc/free function is IMO
> already an improvement.

Exactly. It's perfectly sensible from C++ programmers already using
exceptions and relying on destructors to expect *all* libraries to conform
to this style. Otherwise they'll have to mix "traditional" error handling
with exceptions, which is worse than any of them alone.

IMO, this hurts most when trying to do UNIX(R) systems programming in
"idiomatic" C++.

("Newsgroups: comp.lang.c++" snipped, because I'm not subscribed to it.)

Cheers,
lacos


== 4 of 4 ==
Date: Thurs, Apr 15 2010 4:42 am
From: Öö Tiib


On Apr 15, 10:17 am, Joakim Hove <joakim.h...@gmail.com> wrote:
> I realize that; myself I am perfectly using the C code, however there
> are some people in my organisation with a love/hate relationship with
> C/C++ and I am trying to cater to their "needs". So - it is actually
> the syntax change (and some maintainance overhead....) I am after.

All added 'value' is about interface syntax change? Then you are lucky
who is getting paid for doing questionable things. C is fine language
and such interfaces are pretty readable.

Only value that can be added to good C library interface is to enwrap
that my_struct* into proper smart pointer, my_alloc() into factory
function that produces such smart pointer and ... done.

Usually it is C library itself that is refactored into C++ to
introduce polymorphism instead of overly long switch-case chains and
exceptions instead of overly massive return value handling code. These
two things tend to make legacy C hard to maintain.

==============================================================================
TOPIC: Is this a correct implementation of strstr ?
http://groups.google.com/group/comp.lang.c/t/e69b0f022e4c27e1?hl=en
==============================================================================

== 1 of 5 ==
Date: Thurs, Apr 15 2010 12:23 am
From: Michael Foukarakis


On Apr 15, 6:37 am, Keith Thompson <ks...@mib.org> wrote:
> Kenneth Brody <kenbr...@spamcop.net> writes:
> > On 4/14/2010 4:34 PM, Phil Carmody wrote:
> > > Kenneth Brody<kenbr...@spamcop.net>  writes:
> > [...]
> > >> What happens if, rather than calling mystrchr(foo,160) you use
> > >> mystrchr(foo,'\xa0')?
>
> > > '\xa0' has value 160.
>
> > Even if chars are signed?
>
> > On my system, this prints "-96":
>
> > #include <stdio.h>
>
> > main()
> >          {
> >          int i = '\xa0';
>
> >          printf("%d\n",i);
> >          }
>
> Yeah, mine too.
>
> I didn't read far enough in the standard.  C99 6.4.4.4p9 says:
>
>     Constraints
>
> 9   The value of an octal or hexadecimal escape sequence shall
>     be in the range of representable values for the type unsigned
>     char for an integer character constant, or the unsigned type
>     corresponding to wchar_t for a wide character constant.
>
> I mistakenly took that to be a specification of the value of
> a character constant containing an octal or hexadecimal escape
> sequence, but it isn't. It's just the value of the escape sequence.
> The value of the character constant is defined in paragraph 10,
> under Semantics:
>
>     If an integer character constant contains a single character
>     or escape sequence, its value is the one that results when
>     an object with type char whose value is that of the single
>     character or escape sequence is converted to type int.
>
> I still find the wording a bit shaky.  In '\xa0', the value of the
> escape sequence, as defined by paragraph 9, is 160.  Given that plain
> char is signed and CHAR_BIT==8, an object with type char *cannot*
> have the value 160.
>
> The standard seems to be assuming that the values 160 and -96 are
> interchangeable when stored in a char object.  Either I've missed
> something else obvious (which is quite possible), or the standard
> is playing fast and loose with signed and unsigned values.

If I'm not mistaken, the standard (since ANSI) mandates that char,
signed char and unsigned char are three different types. The whole
confusion in this thread stems from the fact that char has the same
values and representation as either of the other two types - this is
implementation-defined. Personally, I wonder what the rationale for
such a decision was, although I can guess.


== 2 of 5 ==
Date: Thurs, Apr 15 2010 12:40 am
From: Keith Thompson


Keith Thompson <kst-u@mib.org> writes:
[...]
> '\xA0' is of type int with value 160. This is true regardless of the
> range or signedness of plain char, or any other system-specific
> consideration. The constant '\xA0' is the same as the constant 160
> (unless you stringize it).
[...]

For the record, I was wrong about this, as I explained in more
detail elsethread.

--
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 5 ==
Date: Thurs, Apr 15 2010 12:45 am
From: Keith Thompson


Peter Nilsson <airia@acay.com.au> writes:
> On Apr 15, 2:39 pm, Peter Nilsson <ai...@acay.com.au> wrote:
> > Keith Thompson <ks...@mib.org> wrote:
> > > Peter Nilsson <ai...@acay.com.au> writes:
> > > > Phil Carmody <thefatphil_demun...@yahoo.co.uk> wrote:
> > > > > ... on the DS-2010, (char)'\xA0' is 127.
> > > >
> > > > I don't see how it can be. "The value of an integer
> > > > character constant containing a single character that
> > > > maps to a single-byte execution character is the
> > > > numerical value of the representation of the mapped
> > > > character interpreted as an integer."
> > >
> > > It's not the character constant that gives you 127,
> > > it's the conversion specified by the cast.
> >
> > Fair enough, missed the (char).
>
> No, I take that back, I was right the first time. The
> cast to char is redundant as far as converting the value
> of '\xA0' because it is necessarily already in the range
> of char.

Right.

> The only possible values for '\xA0' are:
>
> 160 - char is unsigned
> 160 - char is signed, CHAR_BIT > 8
> -96 - char is signed, CHAR_BIT == 8, two's complement
> -95 - char is signed, CHAR_BIT == 8, ones' complement
> -32 - char is signed, CHAR_BIT == 8, sign magnitude

You're probably right as far as the intent is concerned, but I think
the wording of the standard is internally inconsistent.

--
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"


== 4 of 5 ==
Date: Thurs, Apr 15 2010 2:00 am
From: Ian Collins


On 04/15/10 07:23 PM, Michael Foukarakis wrote:
>
> If I'm not mistaken, the standard (since ANSI) mandates that char,
> signed char and unsigned char are three different types.

Distinct types rather than different, the wording difference is significant.

See section 6.2.5 para 15.

--
Ian Collins


== 5 of 5 ==
Date: Thurs, Apr 15 2010 5:48 am
From: candide


Ian Collins a écrit :

>
> That's the point I've been making all along. The representation of char
> is irrelevant. So back to the original point, the two casts to unsigned
> char are both superfluous and wrong.

I don't work out how you make compatible things both "superfluous" and
"wrong" : usually, superfluous suppose things don't hurt, this is not
usually the case for something _wrong_.

Do you mean the casts are always superfluous and sometimes wrong ?

==============================================================================
TOPIC: errors and casting
http://groups.google.com/group/comp.lang.c/t/eee9a73d267c1066?hl=en
==============================================================================

== 1 of 8 ==
Date: Thurs, Apr 15 2010 12:29 am
From: Nick Keighley


On 14 Apr, 22:36, "Bill Cunningham" <nos...@nspam.invalid> wrote:
> "Bill Cunningham" <nos...@nspam.invalid> wrote in message
>
> news:4bc6307e$0$12445
>
> [...]
>
> > memset(&a,'\0',sizeof a);
> > a.ai_socket = SOCK_STREAM;
> > a.ai_family = AF_INET;
> > a.ai_flags = AI_PASSIVE;
>
>     OK if these need to be within a function please note I if I can don't
> want them in a function. Maybe a header or .o file.

try rewriting it in pascal then


== 2 of 8 ==
Date: Thurs, Apr 15 2010 1:49 am
From: "io_x"

"Bill Cunningham" <nospam@nspam.invalid> ha scritto nel messaggio
news:4bc6307e$0$12445$bbae4d71@news.suddenlink.net...
> I have honestly went over and over this and don't see the errors.

if you can write so difficult english why have you some problem with C?

> In memset's first parameter I even cast a void* and I don't like casts. I
> don't know where the errors are from. I believe I have all the required posix
> standard headers.
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> #include <string.h>
> #include <netdb.h>
> #include <sys/socket.h>
>
> struct addrinfo a, *pa;
>
> int stat;
> void error(void)
> {
> fprintf(stderr, "Error: %d\n", errno);
> exit(EXIT_FAILURE);
> }
>
> memset(&a,'\0',sizeof a);
> a.ai_socket = SOCK_STREAM;
> a.ai_family = AF_INET;
> a.ai_flags = AI_PASSIVE;

what does it mean "AI_PASSIVE?

> 17: error: syntax error before '&' token
> error: conflicting types for 'memset'
> error: conflicting types for 'memset'
> warning: data definition has no type or storage class
> 18: error: syntax error before '.' token
>
> That last error above has me baffled. I have written the error function so I
> can call it when an error check proves there's an error.
>
> Bill


== 3 of 8 ==
Date: Thurs, Apr 15 2010 4:45 am
From: "Bill Cunningham"


io_x wrote:

> if you can write so difficult english why have you some problem with
> C?

[snip]

> what does it mean "AI_PASSIVE?

AI_PASSIVE is a pre-defined macro used in the posix networking standard
to allow getadrrinfo() to fill in the addrinfo struct with an IP address.
Wether that be IPv6 or IPv4.
http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html

Is a good place to read. Notice this is probably OT here and my question had
to do with ANSI C.

Bill


== 4 of 8 ==
Date: Thurs, Apr 15 2010 4:59 am
From: "Bill Cunningham"


Lew Pitcher wrote:

> Yes, Bill, those four statements *cannot* stand alone outside a
> function body.
>
> You are going to have to find a way to /put/ them within a function
> body (your choice of /which/ function body) before your program will
> compile properly.

I was using code from
http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#bind

and these members are referred to not in a function. That's what got me.
They must've been written only as an example.

Bill


== 5 of 8 ==
Date: Thurs, Apr 15 2010 5:20 am
From: blmblm@myrealbox.com


In article <4bc6d0eb$0$1121$4fafbaef@reader3.news.tin.it>,
io_x <a@b.c.invalid> wrote:
>
> "Bill Cunningham" <nospam@nspam.invalid> ha scritto nel messaggio
> news:4bc6307e$0$12445$bbae4d71@news.suddenlink.net...
> > I have honestly went over and over this and don't see the errors.
>
> if you can write so difficult english why have you some problem with C?

Picky speakers of English might point out that "I have went" is, um,
"incorrect"? "non-standard"?

Just sayin'.

I guess it might be interesting to know whether there's any correlation
between ability to learn a human language (particularly one learned as
a first language, as English presumably is for Bill C.) and ability to
to express algorithms in a programming language. But to me it doesn't
seem obvious that the first would necessarily imply the second.

[ snip ]

--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.


== 6 of 8 ==
Date: Thurs, Apr 15 2010 5:59 am
From: "Bill Cunningham"

<blmblm@myrealbox.com> wrote in message
news:82oejlFst6U4@mid.individual.net...

> Just sayin'.
>
> I guess it might be interesting to know whether there's any correlation
> between ability to learn a human language (particularly one learned as
> a first language, as English presumably is for Bill C.) and ability to
> to express algorithms in a programming language. But to me it doesn't
> seem obvious that the first would necessarily imply the second.

I don't like to say this much because I don't like to use it as an
excuse. But anyway I suffer from some nasty side effects from about 8
medications. They are getting ready to put me on addarall for fatigue and
attention deficit or ADD. So I have some trouble getting things finished and
focusing attention.

Just thought I'd say this.

Bill


== 7 of 8 ==
Date: Thurs, Apr 15 2010 6:04 am
From: "Bill Cunningham"

"Bill Cunningham" <nospam@nspam.invalid> wrote in message
news:4bc70d98$0$12433

> I don't like to say this much because I don't like to use it as an
> excuse. But anyway I suffer from some nasty side effects from about 8
> medications. They are getting ready to put me on addarall for fatigue and
> attention deficit or ADD. So I have some trouble getting things finished
> and focusing attention.
>
> Just thought I'd say this.

And konopin casues me to not be able to concentrate. I am not able to
drive now because I can't remember where I'm going or how to get there. In a
town I've lived in all my life.

Bill


== 8 of 8 ==
Date: Thurs, Apr 15 2010 6:29 am
From: ram@zedat.fu-berlin.de (Stefan Ram)


blmblm@myrealbox.com <blmblm@myrealbox.com> writes:
>I guess it might be interesting to know whether there's any correlation
>between ability to learn a human language (particularly one learned as
>a first language, as English presumably is for Bill C.) and ability to
>to express algorithms in a programming language. But to me it doesn't
>seem obvious that the first would necessarily imply the second.

»Besides a mathematical inclination, an exceptionally
good mastery of one's native tongue is the most vital
asset of a competent programmer.«

attributed to Djikstra, but I can not confirm the source

»If your writing is semi-literate, ungrammatical, and
riddled with misspellings, many hackers (including myself)
will tend to ignore you. While sloppy writing does not
invariably mean sloppy thinking, we've generally found the
correlation to be strong -- and we have no use for sloppy
thinkers. If you can't yet write competently, learn to.«

Eric Raymond

http://www.catb.org/~esr/faqs/hacker-howto.html#skills4

»I've found that some of the best developers of all are
English majors. They'll often graduate with no programming
experience at all, and certainly without a clue about the
difference between DRAM and EPROM.

But they can write. That's the art of conveying
information concisely and clearly. Software development
and writing are both the art of knowing what you're going
to do, and then lucidly expressing your ideas.«

http://praisecurseandrecurse.blogspot.com/2007/03/english-majors-as-programmers.html


==============================================================================
TOPIC: Bill Cunningham and sockets for the past six years
http://groups.google.com/group/comp.lang.c/t/1d16924d271398d9?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Apr 15 2010 1:52 am
From: J de Boyne Pollard


> >> He's been at it recently on c.u.p as well.
>
> > That's in fact what led me to post in comp.unix.programmer
> > what M. navia was quoting there.  (-:
>
> Yes but the message had no attributions, sorry.

No worries. I didn't mind. I was just killing two birds
with one post, clueing M. Bos in at the same time.

> My objective was to stop this guy from going on and on...

This wouldn't be the first time that a post of mine has
been used in such a way. You probably won't stop Bill
Cunningham from posting, but with an improved canned
response, that doesn't confuse as M. Bos was confused
here, you can probably stop people falling for it.

> Note that he did NOT answer any of the several messages I sent
> with the same text in the different threads he started.

Xe answered the original, asking us to continue to believe
that xe *really is* Bill Cunningham, Worst Programmer
In The World. We all ignored it, because we've caught
wise. (-:

==============================================================================
TOPIC: how to implement logical equivalence (==) or negation (!) using only
binary operators
http://groups.google.com/group/comp.lang.c/t/996f7df08a4c8123?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Apr 15 2010 2:27 am
From: "Ersek, Laszlo"


On Wed, 14 Apr 2010, Kenneth Brody wrote:

> On 4/14/2010 6:48 PM, Ricky wrote:
>> how to implement logical equivalence (==) or negation (!) for binary
>> numbers using only binary operators such as ~& ^ | +<< >>?
>
> I would just use "==" and "!".
>
> However, consider:
>
> 0 xor 0 == 0
> 0 xor 1 == 1
> 1 xor 0 == 1
> 1 xor 1 == 0
>
> Note the properties:
>
> Xor returns 0 iff the bits are the same.
>
> If you xor with 1, you "toggle" the bit.
>
> How could you use these properties to emulate "==" and "!"?


/* Return 1u if any bit is set in "x", return 0u otherwise. */
unsigned
mig32(uint32_t x)
{
x |= x >> 16; /* "condensed" to bits 15 .. 0 */
x |= x >> 8; /* "condensed" to bits 7 .. 0 */
x |= x >> 4; /* "condensed" to bits 3 .. 0 */
x |= x >> 2; /* "condensed" to bits 1 .. 0 */
x |= x >> 1; /* "condensed" to bit 0 */
return x & 1u;
}


{
uint32_t a, b;

/* ... */

mig32(a) ^ 1u; /* boolean-neg */
mig32(a) ^ mig32(b) ^ 1u; /* boolean-eq; IOW, negated boolean-neq */
}

Cheers,
lacos

==============================================================================
TOPIC: Virus "warnings"
http://groups.google.com/group/comp.lang.c/t/0e5727bb64e230a3?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Apr 15 2010 2:30 am
From: J de Boyne Pollard


> > Look at the subject line. It suggests that the program
> > download does in fact contain a virus.
>
> Virus, what's one of those :)

It's one of those things that Ken Thompson put in your compiler
years ago, that you are unknowingly still infected by today.

Should we take this thread as indicative of the ClamAV people
having finally found a way to beat Ken Thompson? (-:

==============================================================================
TOPIC: Dweebach about void main()
http://groups.google.com/group/comp.lang.c/t/383e6d5a95dc3f75?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Apr 15 2010 5:13 am
From: blmblm@myrealbox.com


In article <dcc8957b-be3b-4267-80ac-9a68b7bebbb2@z7g2000yqb.googlegroups.com>,
spinoza1111 <spinoza1111@yahoo.com> wrote:
> On Apr 14, 12:01 am, Seebs <usenet-nos...@seebs.net> wrote:
> > On 2010-04-13, J de Boyne Pollard <J.deBoynePoll...@Tesco.NET> wrote:
> >
> > > Then you are committing the canonical error, committed by many,
> > > of substituting what you think or want the standard to say
> > > for what the standard actually says. It's the error committed
> > > by some FAQs and by some well-intentioned but misinformed
> > > people. Go and read what the standard *actually says*.
> >
> > I have.
> >
> > I understand it just fine.
> >
> > I think our issue has nothing at all to do with the words in the
> > standard here, but with the question of what it means for the standard
> > to "mandate" something.
> >
> > > Wrong. Go and read what the document actually says.
> >
> > If you want to make a case, you actually have to present some
> > kind of argument, not just assert that you're right.
> >
> > Argument. You know. Explanation of how the data you cite allegedly
> > support your position.
> >
> > You have provided NONE. That's because there isn't one. It's also because,
> > before you could do that, you'd have to offer a clear explanation of what
> > you think it means to say that the standard "mandates" something.
> >
> > Hint: The general permission to offer extensions means that you can always
> > accept new kinds of programs that contradict what the standard mandates.
>
> 5.1.2 WG14/N1124
>
> "Two execution environments are defined: FREESTANDING and HOSTED. In
> both cases, 'program startup' occurs when a designated C program is
> called by the execution environment. All objects with static storage
> duration shall be "initialized" (set to their initial values) before
> program startup. The manner and timing of such initialization are
> otherwise unspecified. 'Program termination' returns control to the
> execution environment."
>
> "In a freestanding environment (in which C program execution may take
> place without any benefit of an operating system)

Note the "without any benefit of an operating system".

> the name and type of
> the function called at program startup are implementation-defined. Any
> library facilities available to a freestanding program, other than the
> minimal set required by clause 4, are implementation-defined."
>
> "The effect of program termination in a freestanding environment is
> implementation-defined."
>
> "A hosted environment need not be provided, but shall conform to the
> following specifications if present."
>
> [Followed by specifications for int main() in the hosted environment]
>
> The standard doesn't "mandate" int main(). It says what a hosted as
> opposed to freestanding execution environment will do with int main().
> Other implementations, known as "freestanding" (including any
> implementation that doesn't flag void main()) are also standard
> implementations, and code that compiles with errors on them is at a
> second level "standard". The distinction between hosted and
> freestanding is not a moral distinction nor is it a distinction
> between "conformant" and "nonconformant".
>
> In fact, it's obvious that the "hosted" implementation was put into
> the standard by way of Linux pressure to overlink, in violation of
> separation of concerns, C to Linux.
>
> Most contemporary uses of C are "freestanding" in that most C programs
> are called from graphical user interfaces not coded in C.

I'm *very* skeptical about this sense of "freestanding" being compatible
with the definition stated/implied by the quoted text above.

> Pressure on organizations to support Linux is represented as some sort
> of crusade for "freedom" in the mythos. But the fact is that Linux, as
> open source, represents a very valuable resource for profit-making
> organizations and to this end, hordes of fools were marshaled and
> deluded as Seebach is.
>
> > That an implementation is permitted, implicitly or implicitly, to accept a
> > program, does not mean that the standard did not mandate something contrary
> > to that program's structure or contents.
> >
> > When we say the standard "mandates" a return type of int, we mean that, if
> > you use any other return type for main(), the standard provides you with
> > no guarantees.
>
> This is false. See above. It simply means that the implementation is
> not hosted.
>
>
> > It is quite possible that an individual implementation will
> > choose to offer you guarantees. It was just as possible in 1989. It doesn't
> > change what the standard requires.
> >
> > If you want to write code which conforms to the C standard, for a hosted
> > implementation, your main() must return int. That compilers *could* accept
>
> No, for only one type of "hosted" implementation: the host as defined
> by the standard.
>
> > other forms doesn't change that. Similarly, you can't rely on the value
> > of a right-shifted signed negative number. That an implementation COULD
> > define that to give you useful results doesn't mean that you can rely on it
> > and claim to be conforming with the standard.
>
> This is absurd. The Standard is open in the sense that it allows
> implementations to have facts about them and programmers to rely on
> those facts.
>
> You're saying, in fact, that C must be used like Java to be
> "standard". But after ten years doing apparently diddly on the
> standards group save pad your resume, you don't understand that the
> Standard is a standard for implementations and not C code.
>
> It's not a very good standard for implementation. But for code, it's
> nonsense.
>
> A dependency in code on ones being shifted in is what C is for:
> systems programming at a level where implementation details,
> especially gross implementation details, are usable and known.
>
> I agree that given your queue.c horror, your failure to correctly
> implement strlen, and your %s nonsense, you shouldn't be using C and
> should retrain in Java, which more resembles the scripting languages
> where your expertise seems to lie.

"Scripting languages"? as best I can tell, Seebs has claimed only
familiarity with UNIX-like command shells, which -- eh, I suppose
they *could* be considered scripting languages, but the ones I know
(Bourne shell and C shell) seem to me to be more similar in spirit
to C than Java, particularly with regard to the difficulties of
writing reliably-portable code.

[ snip ]

--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.

==============================================================================
TOPIC: seebs/schildt
http://groups.google.com/group/comp.lang.c/t/0c84debf9a4f144b?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Apr 15 2010 5:18 am
From: blmblm@myrealbox.com


In article <5f736221-673d-4fdf-92eb-dfec3b4e9a44@z3g2000yqz.googlegroups.com>,
spinoza1111 <spinoza1111@yahoo.com> wrote:
> On Apr 10, 9:51 pm, blm...@myrealbox.com <blm...@myrealbox.com> wrote:
> > In article <slrnhrvtg3.1io.usenet-nos...@guild.seebs.net>,
> >
> > Seebs <usenet-nos...@seebs.net> wrote:

[ snip ]

> > One more question, though, as you attempt to extricate yourself and
> > maybe the rest of us from this endless off-topic, um, "stuff"? :
> >
> > Over and over Nilges talks about your "backstabbing". Do you have
> > any idea what he means by that? It must be a reference to something
> > you said at some point, but I can't remember anything that would
> > fit, and I'm starting to be more than a little curious. Answer
> > not required, of course.
>
> I infer that he's an office backstabber from his treatment of people
> like Navia and myself here, and his treatment of Schildt.

Good heavens. You *infer* this, and use that as the basis for
repeated slurs?

Well, whatever. At least the mystery is resolved.

--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.

==============================================================================
TOPIC: Sad state of standards-conformance and consistency of compilers
http://groups.google.com/group/comp.lang.c/t/8e4236bf3f19c661?hl=en
==============================================================================

== 1 of 2 ==
Date: Thurs, Apr 15 2010 5:20 am
From: Francois Grieu


In another thread, on the sad state of standards-conformance in C
(and C++) compilers, and varying degree of willingness to progress
on that in compiler vendors, I wrote:

A non-obscure compiler (if you visualize what I mean) won't compile:

// return the smallest of x y z
#define MIN3(x,y,z) ( (x)>(y) ? (y)>(z) ? (z) : (y) : (x) )

#define ALPHA 5
#define BETA 4
#define GAMMA 6

#if MIN3(ALPHA,BETA,GAMMA) < 2
#error "check ALPHA BETA GAMMA"

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate