Sunday, December 6, 2009

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

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

comp.lang.c@googlegroups.com

Today's topics:

* How to program a quick sort function? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/fb22fcabe9d81827?hl=en
* Paypal payment free shipping Cheap Wholesale GHD CHI crimping iron (www.
dotradenow.com.cn) - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/92d8eda893794464?hl=en
* Why the usage of while(0) - 6 messages, 5 authors
http://groups.google.com/group/comp.lang.c/t/f4d4f563f51b7d97?hl=en
* pointer arithmetic error? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/df4d26af086108bf?hl=en
* Advacnced C - 5 messages, 3 authors
http://groups.google.com/group/comp.lang.c/t/fbe80c7efe0b1c52?hl=en
* efficient approach to check a set bit - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/14c0813cbd902b38?hl=en
* While(1) or for(;;) for infinite loops? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/f062b5324b425b57?hl=en
* ISO C standard - which features need to be removed? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/441253f1401e8f94?hl=en
* عاااجل ...فيديو عائلة تغرق لا حول ولا قوة إلا بالله - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/8c98b9c67e998829?hl=en
* cheap wholesale nike max TN shoes,jordan wholesale,air force one,wholesale
jordan,nike shox wholesale - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/1688de9230bf9bc7?hl=en
* discount Nike NBA Basketball Players Sneakers-Nike Air Zoom -LeBron James
and kobe sneakers - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/58a80017f78a708e?hl=en
* Discount Wholesale Versace Jeans G-STAR Jeans ED Hardy Jeans D&G Jeans(www.
dotradenow.com.cn) - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/e2a3a8c13407ed80?hl=en

==============================================================================
TOPIC: How to program a quick sort function?
http://groups.google.com/group/comp.lang.c/t/fb22fcabe9d81827?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Dec 6 2009 12:01 am
From: Seebs


On 2009-12-06, Thomas Dean <tomdean001@gmail.com> wrote:
> It is said that quick sort has been the fastest sorting algorithm so
> far.

Not by anyone informed.

> So how to program it?

Ask your TA or instructor if you need help.

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


== 2 of 2 ==
Date: Sun, Dec 6 2009 2:03 am
From: mohangupta13


On Dec 6, 12:47 pm, Thomas Dean <tomdean...@gmail.com> wrote:
> It is said that quick sort has been the fastest sorting algorithm so
> far. So how to program it?
Well in practice and in general cases more often it gives better
runtime then other comparison sorting algorithms.
> If you know, could you please teach me? Thank you anyway.
You can look at http://en.wikipedia.org/wiki/Quicksort that must have
a good explanation.
I will briefly tell you the main idea .
Given a set of numbers S{ a,b,c,d,e...} choose a number randomly
(randomized quicksort) say 'd' . Now move all elements <= 'd' on the
left side of the set and all the elements >'d' on the right
side .Place 'd' between these two parts of the set. Now recursively
sort both parts.( Note at this point 'd' is fixed at a location , it
doesn't belong to either part and should not be moved ).

Example: S{ 5,2,7,1,6}
Step1: randomly choose an element say 2
Step 2: partition : s1{1}, s2{5,6,7} so that S looks like S1 2 S2
(note 2 is between S1 and S2 )
step 3: Recursively do the same with S1 ans S2 ( the base case of
recursion is : return when the set is having 0 element).

Thanks
Mohan

==============================================================================
TOPIC: Paypal payment free shipping Cheap Wholesale GHD CHI crimping iron (www.
dotradenow.com.cn)
http://groups.google.com/group/comp.lang.c/t/92d8eda893794464?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Dec 6 2009 12:35 am
From: tradeyoyo


GHD MK4 MK5 cheap Wholesale, GHD hair straightener wholesale

Cheap Benefit GHD (www.dotradenow.com.cn)

Cheap Black GHD (www.dotradenow.com.cn)

Cheap Dark GHD (www.dotradenow.com.cn)

Cheap pink GHD (www.dotradenow.com.cn)

Cheap new style Leopard GHD (www.dotradenow.com.cn)

Cheap IV mini styler GHD (www.dotradenow.com.cn)

Cheap rare Leopard GHD (www.dotradenow.com.cn)

Cheap rare newest Leopard style (www.dotradenow.com.cn)

Cheap Gold GHD (www.dotradenow.com.cn)

Cheap Kiss GHD (www.dotradenow.com.cn)

Cheap pink MK5 (www.dotradenow.com.cn)

Cheap black GHD (www.dotradenow.com.cn)

Cheap limited edition MK5 (www.dotradenow.com.cn)

Cheap pure black GHD MK5 (www.dotradenow.com.cn)

Cheap pure white GHD (www.dotradenow.com.cn)

Cheap Pink style GHD (www.dotradenow.com.cn)

Cheap Purple style GHD with dryer (www.dotradenow.com.cn)

Cheap Salon GHD (www.dotradenow.com.cn)

CHI

Cheap Ammy green CHI (www.dotradenow.com.cn)

Cheap Black style CHI (www.dotradenow.com.cn)

Cheap Blue style CHI (www.dotradenow.com.cn)

Cheap Camouflage Blue CHI (www.dotradenow.com.cn)

Cheap Camouflage pink CHI (www.dotradenow.com.cn)

Cheap Peachblow CHI (www.dotradenow.com.cn)

Cheap Pink style CHI (www.dotradenow.com.cn)

Cheap Red-black CHI (www.dotradenow.com.cn)

Cheap Wide red-black CHI(www.dotradenow.com.cn)

Cheap crimping iron (www.dotradenow.com.cn)

==============================================================================
TOPIC: Why the usage of while(0)
http://groups.google.com/group/comp.lang.c/t/f4d4f563f51b7d97?hl=en
==============================================================================

== 1 of 6 ==
Date: Sun, Dec 6 2009 1:33 am
From: Flash Gordon


James Dow Allen wrote:
> On Dec 6, 2:25 am, Eric Sosman <esos...@ieee-dot-org.invalid> wrote:
>> James Dow Allen wrote:
>>> I would like to hear an answer to my question:
>>> What do anti-goto fanatics think of this method of
>>> avoiding goto?
>> .
>> Since anyone who answers implicitly asserts that he
>> is in fact a "fanatic," there may be some reluctance to
>> respond ...
>
> Sorry again; this superfluous pejorative was
> uncalled-for. But surely comments from any
> c.l.c'ers are welcome; admission or denial of
> fanaticism is optional. :-)

I'm not fanatical, but I have seen code which is horrendous in part due
to the use of goto.

> (Given that some c.l.c'ers proudly embrace the
> term "Pedant", I'd not be surprised if some happily
> acknowledge fanaticism. Probably I could be accused
> of fanaticism on some topics; e.g. refusal to
> issue blanket condemnation of 'goto'. :-)
>
> But anyway, this particular usage of
> do {
> ... break;
> ... continue;
> } while (0);

I've used that kind of pattern. I've also used a pattern of..

static int dirtyfoo(params)
{
ret = ok
do stuff
if error return notsolateerror

do stuff
if error return verylateerror

do stuff

return OK
}

int foo(params)
{
ret = dirtyfoo(params)
switch (ret) {
case verylateerror: clean up late stuff
case notsolateerror: clean up not so late stuff
...
}
return ret;
}

The cleanup stuff here was sending appropriate cleanup bits to an
external system over a socket. The goto type alternative would have been

int foo(params)
{
do stuff
if error { ret = notsolateerror; goto notsolateerror }
do stuff
if error { ret = verylateerror; goto verylateerror }
do stuff
return OK

verylateerror:
clean up late stuff
notsolateerror:
clean up not so late stuff
return ret
}

There were actually a hole load of sub functions, with sub functions,
all returning statuses, with the status codes selected to I could just
propagate them out to the external caller.

I think my splitting out the work in to a sub-functions and abusing a
switch for the cleanup worked well, especially as there was no cleanup
if it was all OK.

> to avoid 'goto commoncase;' is uninteresting compared
> to the goto in
> http://james.fabpedigree.com/gotoalt.htm
>
> I *do* hope c.l.c'ers will read that page and comment.
> So far only two votes have been recorded:
> Tim votes for Tim's code.
> James votes for James' code.
> Others?

I would have to think hard about it, but it feels like some kind of
recursive solution might be cleaner. Possibly a function for each of the
loops in the first block, with the loop done by a recurse in each case,
the retract done on the unwind with, of course, a done result allowing
you to unwind without retracting. I'm not up to working it out at the
moment, in part due to not understanding the problem being solved by it.

> (I'm tempted to confess, in another thread,
> that I use 'goto' in transition-machine code, but
> may not dare unless I get some votes in *this* poll.)

Well, I've used loops, switches and state variable for state machines
where others use gotos in the past. I seem to remember also using a
function table and state variable once for a state machine...
initialise state
loop
state = call action[state]
until state is finished
so each function in the action array returned the next state, all nicely
named with an enum.

I will use goto sometimes, mainly for exception handling.
--
Flash Gordon


== 2 of 6 ==
Date: Sun, Dec 6 2009 4:40 am
From: Nick <3-nospam@temporary-address.org.uk>


James Dow Allen <jdallen2000@yahoo.com> writes:

> Actually there were three or so of these do while (0)'s
> all within the same giant switch block. Moreover, there
> were other blocks nesting between the switch and the do while's:
> blocks just to declare local automatic variables.

I do the latter, although I'm never very happy about it:
switch(a) {
case 10:
{
int p,r,s;
... do stuff with p,r and s ...
break;
}
case 11:
}

In a really fiddling point of style, I often wonder which side of close
brace the "break" should be.
--
Online waterways route planner: http://canalplan.org.uk
development version: http://canalplan.eu


== 3 of 6 ==
Date: Sun, Dec 6 2009 5:37 am
From: phil-news-nospam@ipal.net


On Fri, 04 Dec 2009 13:14:00 +0000 Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
| Riccardo Manfrin <namesurname@guesswhat.guesswhat> writes:
|
| [This shoudl be a FAQ but I can't currently check since the C FAQ site
| appears to be down.]
|
|> Having this code:
|> do {
|> if (flag_prg)
|> printf("%-" PROGNAME_WIDTHs "s"," " PROGNAME_BANNER);
|> } while (0)
|>
|> why the use of while?
|
| As you present it, none. In fact it's a syntax error since there is
| no ; after the while (0). This is a big clue that the code comes
| from a macro.
|
| The purpose of the loop is syntactic. It encloses the 'if' in a
| statement (when the ; is added by the macro invocation) so that no
| surprises happen to the users of the macro. Consider the simpler:
|
| #define PRINT_BANNER if (flag_prg) \
| printf("%-" PROGNAME_WIDTHs "s"," " PROGNAME_BANNER)
|
| and a usage like this:
|
| if (first_run)
| PRINT_BANNER;
| else puts("Going again...";
|
| The 'else' will be taken to be part of the inner if regardless of the
| indentation. do {} while (0) gets round this and other potentials
| problems with macros that expand to statements.

Do you have an example where enclosing in plain { } is not good enough?

--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------


== 4 of 6 ==
Date: Sun, Dec 6 2009 5:44 am
From: James Dow Allen


On Dec 6, 4:33 pm, Flash Gordon <s...@spam.causeway.com> wrote:
> James Dow Allen wrote:
> >    http://james.fabpedigree.com/gotoalt.htm
> .
> > I *do* hope c.l.c'ers will read that page and comment.
> > So far only two votes have been recorded:
> >    Tim votes for Tim's code.
> >    James votes for James' code.
> > Others?
> .
> I would have to think hard about it, but it feels like some kind of
> recursive solution might be cleaner....

You could be right (though perhaps a somewhat different
recursion than you outline), and end up with code more
readable than either James' or Tim's, though somewhat slower.
I'm not sure how much slowdown would be acceptable while
still conceding superiority.

But only Tim and James have taken the time to actually
produce working code. *If you're forced to choose
between these two versions*, which would you pick?

James


== 5 of 6 ==
Date: Sun, Dec 6 2009 5:44 am
From: phil-news-nospam@ipal.net


On Sat, 5 Dec 2009 19:07:02 +0000 (UTC) Antoninus Twink <nospam@nospam.invalid> wrote:

| On 5 Dec 2009 at 18:59, James Dow Allen wrote:
|> I would like to hear an answer to my question: What do anti-goto
|> fanatics think of this method of avoiding goto?
|
| Are there many anti-goto fanatics left? I thought most people nowadays
| had grown up and taken a less dogmatic and more pragmatic approach to
| programming.

What is the difference between an anti-goto fanatic and an anti-goto
advocate?

What about the anti-goto-into-the-middle-of-a-loop fanatics?

--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------


== 6 of 6 ==
Date: Sun, Dec 6 2009 6:57 am
From: Phil Carmody


Nick <3-nospam@temporary-address.org.uk> writes:
> switch(a) {
> case 10:
> {
> int p,r,s;
> ... do stuff with p,r and s ...
> break;
> }
> case 11:
> }
>
> In a really fiddling point of style, I often wonder which side of close
> brace the "break" should be.

case pairs with break, as the case is outside the {, the break
should be outside the }. I find that observance of that to be
very rare compared to the style you quote.

Phil
--
Any true emperor never needs to wear clothes. -- Devany on r.a.s.f1

==============================================================================
TOPIC: pointer arithmetic error?
http://groups.google.com/group/comp.lang.c/t/df4d26af086108bf?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Dec 6 2009 2:41 am
From: Antoninus Twink


On 6 Dec 2009 at 7:19, Richard wrote:
> Wouldn't numBeers be so much more readable?

Readable isn't often a word that springs to mind to describe a name in
camelcase.

== 2 of 2 ==
Date: Sun, Dec 6 2009 7:20 am
From: Richard


Antoninus Twink <nospam@nospam.invalid> writes:

> On 6 Dec 2009 at 7:19, Richard wrote:
>> Wouldn't numBeers be so much more readable?
>
> Readable isn't often a word that springs to mind to describe a name in
> camelcase.
>

Horses for (or should that be Camels) for courses. I personally find it
very readable. The nature of the upper case at word boundaries makes it
pretty obvious immediately where the names components are.


--
"Avoid hyperbole at all costs, its the most destructive argument on
the planet" - Mark McIntyre in comp.lang.c

==============================================================================
TOPIC: Advacnced C
http://groups.google.com/group/comp.lang.c/t/fbe80c7efe0b1c52?hl=en
==============================================================================

== 1 of 5 ==
Date: Sun, Dec 6 2009 2:46 am
From: Nick <3-nospam@temporary-address.org.uk>


Antoninus Twink <nospam@nospam.invalid> writes:

> On 3 Dec 2009 at 19:05, Tim Streater wrote:
>> On 03/12/2009 18:57, Antoninus Twink wrote:
>>> It is 100% true. Han from China dug out the quotes. Of course, you
>>> ignored this inconvenient evidence.
>>
>> No such person, Twinky.
>
> Are you mad? Check out
> http://groups.google.com/group/comp.lang.c/msg/c29809cd75412536
>
> Here's the relevant part. Let's see if Heathfield will address the
> evidence this time round - but fair-minded readers will quickly make up
> their minds for themselves about who exactly is the liar here.
>
>
> === begin HfC ===
>
> I've found *some* quotes (I have no idea how complete this list is) as
> evidence for my assertions. I realize Heathfield has denied the plugs in
> this thread, and to be fair, we shouldn't call that lying, since these
> posts were from many years ago, and nobody can be expected to remember
> all the details of what he posted to a newsgroup many years ago. The
> Heathfield from that time was actually a pretty likeable fellow.
>
> Richard Heathfield
> Oh dear. I can't exactly give you the Amazon link because it would be
> /too/ much like spam. Suffice to say that I just checked Amazon and it
> is indeed there. If you do a search for "Richard Heathfield" it finds
> it
> straight away. If you search using "C Unleashed" it's about five or
> six
> books down on the list.

I've snipped the rest, but this (to a new and niave reader) and the rest
sound like they could very well be responses to "Tell us about the book
Richard". What he was denying a couple of posts back was posting
unasked for mentions of the book.

I really don't care enough about this to go pulling the posts to see.
I'm astonished anyone does.
--
Online waterways route planner: http://canalplan.org.uk
development version: http://canalplan.eu


== 2 of 5 ==
Date: Sun, Dec 6 2009 2:50 am
From: Nick <3-nospam@temporary-address.org.uk>


Antoninus Twink <nospam@nospam.invalid> writes:

> On 4 Dec 2009 at 20:30, Eric Sosman wrote:
>> I made a guess and Googled for the combination of the two phrases "you
>> are" and "and I claim my", and was thereby enlightened.
>
> Interesting, Eric!
>
> Thanks for sharing.
>
> I suppose a better question is: what causes a once-popular expression to
> be forgotten, then a few decades later rediscovered and find currency
> once again?
>
> Perhaps there is something intrinsically attractive about the phrase or
> idea, so that once a generation has passed since it became stale as a
> cliche, it naturally captures the imagination of people who never knew
> it the first time.

It's been circulating very quietly in British society for a while. I
actually remember the seaside competitions from my youth, and I'm not
that ancient. It's been in active use in a number of uk. newsgroups for
a long time, as it seems particularly appropriate for that sort of
competition. It's so common that I know of at least one group where
YAMAICM5P (where 'M' is "me") is a common abbreviation, as are versions
with a name shoehorned into the middle of the alphabet soup.
--
Online waterways route planner: http://canalplan.org.uk
development version: http://canalplan.eu


== 3 of 5 ==
Date: Sun, Dec 6 2009 5:22 am
From: gazelle@shell.xmission.com (Kenny McCormack)


In article <87r5r88jo3.fsf@temporary-address.org.uk>,
Nick <3-nospam@temporary-address.org.uk> wrote:
...
>I've snipped the rest, but this (to a new and niave reader) and the rest
>sound like they could very well be responses to "Tell us about the book
>Richard". What he was denying a couple of posts back was posting
>unasked for mentions of the book.

In principle, you are right. However, as you will see, principle has
long been abandoned in CLC, and really has nothing to do with how we do
things here. (Aside: As you claim to be a newbie here, I'm taking a
tone of instruction here - instructing you on how we do things in CLC).

Since we deal in absolutes, the point is that Heathfield made a claim
like "I have never mentioned my book in CLC", which Han easily
disproved.

Further, note that anytime Jacob mentions his compiler, in any context,
for any reason, he gets flamed into next Thursday by Heathfield and his
gang. Fair is fair.

Finally, I don't think it is at all unlikely that Heathfield created a
sock puppet (or, equivalently, got a toadie to do it) to ask about his
book, so that he could preen about it. You are free to believe
otherwise, of course.

== 4 of 5 ==
Date: Sun, Dec 6 2009 5:37 am
From: Rui Maciel


Antoninus Twink wrote:

> I will spell your name however I like if I feel it adds emphasis to what
> I'm saying.
<snip nonsense>

For someone complaining about a signal to noise problem you seem to be very happy
posting a considerable amount of cruft to this newsgroup.


Rui Maciel


== 5 of 5 ==
Date: Sun, Dec 6 2009 5:58 am
From: gazelle@shell.xmission.com (Kenny McCormack)


In article <4b1bb3a9$0$30539$a729d347@news.telepac.pt>,
Rui Maciel <rui.maciel@gmail.com> wrote:
>Antoninus Twink wrote:
>
>> I will spell your name however I like if I feel it adds emphasis to what
>> I'm saying.
><snip nonsense>
>
>For someone complaining about a signal to noise problem you seem to be
>very happy
>posting a considerable amount of cruft to this newsgroup.

One man's meat is another man's poison.

And vice versa.


==============================================================================
TOPIC: efficient approach to check a set bit
http://groups.google.com/group/comp.lang.c/t/14c0813cbd902b38?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Dec 6 2009 2:58 am
From: Nick <3-nospam@temporary-address.org.uk>


Beej Jorgensen <beej@beej.us> writes:

> Antoninus Twink <nospam@nospam.invalid> wrote:
>>If it was doing an integer division (as it surely is in the unoptimized
>>version)
>
> There's a mult in the unoptimized version, but surprisingly no div.
> My x86-fu is weak, so I can't really decode it, but I know there are no
> DIVs in there. :) Lotsa moves, a mult, four shifts, two adds, and two
> subtracts.
>
> Most fun is the use of the constant 0xBACF914D in the mod calculation.
> They multiply that by the value to lookup, and discard the low 32-bits
> of the result. Then from that they subtract the value to lookup, and
> shift the result right by one. From there, things start to get strange,
> until, 11 instructions later, they magically end up with an index into
> the lookup table.
>
> In short, I'm very glad that people specialize in exactly this thing. :)

So we have an arcane arithmetical hack at source code level which is
optimised by the compiler into a different and equally arcane hack at
machine code level.

Wonderful!
--
Online waterways route planner: http://canalplan.org.uk
development version: http://canalplan.eu


== 2 of 2 ==
Date: Sun, Dec 6 2009 6:50 am
From: Phil Carmody


Ian Collins <ian-news@hotmail.com> writes:
> Phil Carmody wrote:
> > raltbos@xs4all.nl (Richard Bos) writes:
> >> Mark Dickinson <dickinsm@gmail.com> wrote:
> >>
> >>> On Dec 4, 9:16=A0am, "Paul" <-> wrote:
> >>>> "sanjib" <sanjibkd...@gmail.com> wrote in message
> >>>>> 1. What might be an efficient and fastest way to check set bits of an
> >>>>> integer ? Suppose I have one bit set out of 32 bits of an integer.
> >>>>> =A0 (I can think of K&R approach i.e. based on iterations which is
> >>>>> equal to the no of set bits in an integer.)
> >>>> If you definitely only have one bit set, you could try using a switch/
> >>>> case, and hope that the compiler makes it a fast one.
> >>> From the evil tricks department, assuming you really do have exactly
> >>> one bit set: the values 1, 2, 4, ..., 1<<31 are all distinct modulo
> >>> 37, so simply reduce modulo 37 and then use a lookup table.
> >> That's a _very_ evil trick. I like it.
> > If you use it, try to use a variation which avoids UB.
> > Reduction modulo 37 may not be a fast operation, so a
> > multiply and shift version may be better. A 5-bit LFSR
> > is your friend.
>
> or an optimiser that does the trick for you.

Oh, I don't mean reduction modulo 37 using a multiply, I mean a
completely different { 2^i: i \in 0..32 } -> { 0 .. 31 } mapping.

For example, taking an 8-bit example, multiply by a magic constant
like 0b0001110100, which has every single possible 3-bit subsequence,
which can be extracted from a fixed location after the multiplication.

Phil
--
Any true emperor never needs to wear clothes. -- Devany on r.a.s.f1

==============================================================================
TOPIC: While(1) or for(;;) for infinite loops?
http://groups.google.com/group/comp.lang.c/t/f062b5324b425b57?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Dec 6 2009 4:25 am
From: Thomas Stegen


Tim Streater wrote:

> Well, it depends. Typically when I write such a loop there may be
> several breaks depending on what has actually occurred, typically error
> conditions. If I'm reading text from the network and parsing it, I can
> have network errors, unexpected or incorrect text from the remote end,
> database errors while I try to save the text, ...
>
> That is not amenable to a simple while (!done) { done=stuff(); } sort of
> construct.

In general I agree with Richard H. I try to avoid several exits from a
block of code and try to stick with one return from a function. The
reason is not that code following that style is easier to read but that
it is easier to change. It also has the effect of making functions
shorter to be able to do this. Because if a function does one thing and
one thing only, then it reports on one thing as well.

If you have multiple fail conditions I would think that the above
becomes while (status != DONE) { status=stuff(); } //check status here

I have never regretted following this style, but I have several times
regretted not doing it.

--
Thomas.


== 2 of 2 ==
Date: Sun, Dec 6 2009 6:35 am
From: Michael Tsang


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not Really Me wrote:

> I assume this has come up before but I am getting nowhere with searches.
>
> To make an infinite loop, while(1) tends to generate lint/compiler
> warnings, for(;;) does not.
>
> Other than personal preference, are there any other technical reasons to
> pick one over the other?
>
> I will stipulate for the argument that performance is identical.
>

I normally prefer while(true) because it's the most straight forward and
everyone knows it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAksbwUgACgkQG6NzcAXitM+3GQCdHlJ6okASx172MOop/QBBsv9X
paUAoIsdnr6G1OLLcthGZtwTfZ51dRvD
=JOKN
-----END PGP SIGNATURE-----


==============================================================================
TOPIC: ISO C standard - which features need to be removed?
http://groups.google.com/group/comp.lang.c/t/441253f1401e8f94?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Dec 6 2009 4:36 am
From: Marco


On Nov 29, 11:51 am, "Malcolm McLean" <regniz...@btinternet.com>
wrote:
> "Marco" <prenom_no...@yahoo.com> wrote in message news:
> >On a previous thread many folks lamented about the C99 standard not
> >being fully implemented and still referencing the C95 version. Maybe
> >the ISO needs to reconsider some of the C99 features that are not
> >being universally implemented in C compilers and make them an optional
> >feature or deprecate them.  The C99 standard has a lot of good changes
> >like defining portable fixed width integers <stdint.h> but these tend
> >to be overshadowed by the un-implemented features.
>
> >Any suggestions?
>
> variable length arrays.

good choice - not many compilers have implemented it

> Also, the different integer types have a huge drawback, which is that the
> exact type has to be passed by indirection. The more types you have, the
> less likely it is that the type ypu are using in caller matches the type
> demanded by callee.

not sure what you mean here - the fixed width types should be used
where necessary such as interfacing to HW registers.
For most algorithm use - I would just use a "int" or "long" type with
an assert if the caller did not conform on the particular platform
that the code was compiled on

you think that the bad old days (C89) where every project rolled their
own 32, 16, 8 bit, etc unsigned integer is the way to go??

I mostly do embedded work

==============================================================================
TOPIC: عاااجل ...فيديو عائلة تغرق لا حول ولا قوة إلا بالله
http://groups.google.com/group/comp.lang.c/t/8c98b9c67e998829?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Dec 6 2009 5:11 am
From: املي


مشروع الكتاب التفاعلي
http://www.amlly.com/vb/t16577.html
ديكورات روووووووعه
http://www.amlly.com/vb/t16576.html
الى اهل اليمن
http://www.amlly.com/vb/t16575.html
فلاش قصيدة ليلة قمريه
http://www.amlly.com/vb/t16574.html
انا امرأة أيها الرجل
http://www.amlly.com/vb/t16573.html
حالة شفيت من مرض الصرع
http://www.amlly.com/vb/t16571.html
ماتخافي من سوق الانترنت
http://www.amlly.com/vb/t16570.html
بجد هام جدا عن الاضرار الناتجة باكياس الشاي المغلقة
http://www.amlly.com/vb/t16569.html
كيفيه محو الصور من الجهاز نهائيا.... ( مهم للبنات)
http://www.amlly.com/vb/t16568.html
الحب في الصين‎
http://www.amlly.com/vb/t16567.html
نغمة تناسب روح الشباب العصرية
http://www.amlly.com/vb/t16566.html
حكم قول الله يقرفك,
http://www.amlly.com/vb/t16565.html
خمسة احجار كريمة من أجل حياة أفضل
http://www.amlly.com/vb/t16564.html
لو بقولو انتي {دوبا} جاوبيهم ذي قديمه ...!
http://www.amlly.com/vb/t16563.html
شوفوو وش سووت الهبله
http://www.amlly.com/vb/t16562.html
[الصَداقَہ] مَالهَا بند ۈ شرُوط الصَداقَہ سَاسهَا صُون ~»]العَهد ..!
Mms
http://www.amlly.com/vb/t16561.html
اجمل نغمة في تاريخ الموسيقي العالمية والعربية
http://www.amlly.com/vb/t16560.html
نجمة اجتماعية في سماء مدينة بيت ساحور
http://www.amlly.com/vb/t16559.html
لـــما الشــوارعَ أمِـطرت طــاحتّ مـواجعــناِ ; ويــنكَ .. جـانا
مـطرْ ؟ ~ ( pic )
http://www.amlly.com/vb/t16558.html
عاااجل ...فيديو عائلة تغرق لا حول ولا قوة إلا بالله
http://www.amlly.com/vb/t16557.html
ملابس اطفال تجنن
http://www.amlly.com/vb/t16556.html
وأخيراً سلطة طحينة الطازج
http://www.amlly.com/vb/t16555.html
ماأروع العيش بمشاعرنا ...لكن الاروع تقدير مشاعر الاخرين..!!
http://www.amlly.com/vb/t16554.html
جاكيتاات سبوورت ولا أروووع o_O
http://www.amlly.com/vb/t16553.html
برنامج aRed v.1.0 S60 3rd Unsigned للتنقل بين البرامج بواسطة الزر
الأحمر
http://www.amlly.com/vb/t16552.html
نغمة رسالة نوكيا و لكن باسلوب مبدع
http://www.amlly.com/vb/t16551.html
لحظة ضعفك...
http://www.amlly.com/vb/t16550.html
إْحــدث الأختــرآعـآت في اليـآبـآن :: تعلموآ تعلموآ‎
http://www.amlly.com/vb/t16549.html
أين امضي بهمومي!!!
http://www.amlly.com/vb/t16548.html
أخواني ،،،‎
http://www.amlly.com/vb/t16547.html

==============================================================================
TOPIC: cheap wholesale nike max TN shoes,jordan wholesale,air force one,
wholesale jordan,nike shox wholesale
http://groups.google.com/group/comp.lang.c/t/1688de9230bf9bc7?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Dec 6 2009 6:47 am
From: "www.vipshoeshop.com"


vipshoeshop Co.,Ltd( www.vipshoeshop.com ) wholesale cheap jordan
shoes,buy New arrival nike jordan sneakers,discount nike kids series
shoes,mix jordan sneakers,custom nike sb dunks,gucci tennis shoes for
discount, sell jordan sneakers for men's women's kids,cheap nike
trainers retro shoes,nike dunks premium sb,cheap nike zoom kobe 4
sneakers free shipping wholesale nike dunk sb shoes,Jordan
spiz"ikes,nike factory for authentic brand name sneakers,jordan
spiz'ikes,jordan mixed with air force ones,cheap nike shox
oz,nz,R3,R4,R5,TL2,TL3,TL4,TL5,cheap air force ones outlet,nike
sneakers for sale,discount air max 87,max 90,max 91,max 95,max 97,max
180,max 360,max TN,max LTD,discount nike women sneakers free
shipping,cheap D&G gucci prada chanel shoes timberland boot ugg
kick,discount bape stat shoes for sale.

==============================================================================
TOPIC: discount Nike NBA Basketball Players Sneakers-Nike Air Zoom -LeBron
James and kobe sneakers
http://groups.google.com/group/comp.lang.c/t/58a80017f78a708e?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Dec 6 2009 6:49 am
From: "www.vipshoeshop.com"


vipshoeshop Co.,Ltd(www.vipshoeshop.com) wholesale nike jordan
sneakers big cheap air jordan sneakers for sale.discount china nike
dunk sb shoes,nike exclusive jordan sneakers,custom nike air force one
sneakers,nike dunk cheap,nike jordan sneakers wholesale,discount supra
shoes wholesale new balance shoes puma shoes,cheap adidas
shoes,authentic jordan sneakers,wholesale nike max 90 sheos,china
supplier nike max 87 max 2009 max 360 shoes,hot max 95 shoes,free
shipping prada shoes,nike retro jordan snekaers,other nike running
shoes,wholesale nike lebron james 6 sneakers,cheap nike zoom kobe 4
sneakers free shipping, kids jordan sneakers wholesale, nike air force
one 1 fusion jordan sneakers,buy sneaker for cheap,nike air max
premium leather sneakers,gucci tennis shoes for discount,high quality
gucci shoes,wholesale jordan fusion sneakers from china supply,cheap
air bape sneakers, China Nike product manufacturer,gucci shoes,supply
puma sneakers timberland shoes,discounts Jordans kicks shoes Cheap
Discount Basketball Sneakers on Sale, Nike Retro Air Jordan Melo M5,
United States Christian Audigier T-Shirt Wholesale Christian Audigier
T-Shirt New cheap Christian Audigier T-Shirt Manufacturers
Suppliers,Wholesale Ed hardy AF T-Shirt, Discounted Louis Vuitton
Designer Handbags Clothes,Chanel and Coach Designer Handbag Wallets
Purse,Replica Louis Vuitton Handbag Accessories,Cheap Gucci handbags
Designer handbags by Gucci leather Purses Belt sunglasses,nike air
zoom signature basketball shoes,

==============================================================================
TOPIC: Discount Wholesale Versace Jeans G-STAR Jeans ED Hardy Jeans D&G Jeans(
www.dotradenow.com.cn)
http://groups.google.com/group/comp.lang.c/t/e2a3a8c13407ed80?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Dec 6 2009 6:55 am
From: tradeyoyo


Discount Wholesale Affliction Jeans <free shipping paypal payment>
Discount Wholesale AK Jeans ( www.dotradenow.com.cn )
Discount Wholesale Armani Jeans
Discount Wholesale Artful Dodger Jeans <free shipping paypal payment>
Discount Wholesale BAPE Jeans
Discount Wholesale BBC Jeans ( www.dotradenow.com.cn )
Discount Wholesale Black Label Jeans
Discount Wholesale Cavalli Jeans
Discount Wholesale Christian Audigier Jeans
Discount Wholesale Coogi Jeans
Discount Wholesale Crown Holder Jeans ( www.dotradenow.com.cn )
Discount Wholesale D&G Jeans
Discount Wholesale Diesel Jeans
Discount Wholesale ECKO Jeans ( www.dotradenow.com.cn )
Discount Wholesale ED Hardy Jeans
Discount Wholesale Evisu Jeans
Discount Wholesale G-STAR Jeans <free shipping paypal payment>
Discount Wholesale GUCCI Jeans
Discount Wholesale Iceberg Jeans
Discount Wholesale Kanji Jeans ( www.dotradenow.com.cn )
Discount Wholesale Laguna Beach Jeans
Discount Wholesale Levi s Jeans
Discount Wholesale LRG Jeans <free shipping paypal payment>
Discount Wholesale LV Jeans
Discount Wholesale Prada Jeans ( www.dotradenow.com.cn )
Discount Wholesale RMC Jeans
Discount Wholesale Roca Wear Jeans <free shipping paypal payment>
Discount Wholesale Rock&Republic Jeans
Discount Wholesale True Religion Jeans <free shipping paypal payment>
Discount Wholesale Versace Jeans
Discount Wholesale ZEN Jeans ( www.dotradenow.com.cn )


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.c"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.c?hl=en

To unsubscribe from this group, send email to comp.lang.c+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate