Re: How do I convert an int to binary form?
- From: pete <pfiland@xxxxxxxxxxxxxx>
- Date: Mon, 13 Feb 2006 16:44:39 GMT
CBFalconer wrote:
pete wrote:
CBFalconer wrote:
CBFalconer wrote:
pete wrote:
... snip ...
The first time that our friend CBFalconer
noticed my (n-- != 0) stepping through an array,
as I recall, he really didn't like it.
I can't recall any words from that thread to google on though.
It took him a while to get used to it.
I don't recall that. I would be more likely to omit the "!= 0"
portion though. If n was a pointer I still object.
... snip ...
By the time that the "Implementing my own memcpy" thread
came up, CBFalconer had come around.
http://groups.google.com/group/comp.lang.c/msg/758f034e126b05cb
I'm offline, so can't use that to refresh any memories. I never
"come around". I may occasionally expand my horizons. Extreme
crusty dogmatism is the watchword here.
I looked up your reference during an online interim. It was
actually "n-- >= 0" with n an unsigned integer, leading to an
infinite loop. I certainly never even approached "coming around".
No. The above URL is one where you advocate (n--)
in response to Richard Harter blowing it with (--n >= 0).
This is an older URL of your having seen
while (nmemb-- != 0)
and not understanding it:
http://groups.google.com/group/comp.lang.c/msg/927d192c5f9d9e90
Are you trolling? The following is pasted from that reference:
-------------------- start ------------------
pete wrote:
... snip ...
void free_ptrs(char **s, size_t nmemb)
{
while (nmemb-- != 0) {
free(s[nmemb]);
}
}
A slight reorganization adds a world of safety, and makes it do the
right thing when nmemb is zero.
void free_ptrs(char **s, size_t nmemb)
{
while (nmemb) free(s[--nmemb]);
}
----------------- end paste -----------------
In future kindly post quotations rather than such (awkward to get
at for me) references. I stand by everything I said back then.
No you don't. You took it back.
http://groups.google.com/group/comp.lang.c/msg/76918442af5e6884
If
you disagree go ahead and quote and argue out in the open.
"Apologies. The original does work correctly. I was thinking
(faultily) that it would do the unsigned wrap around thing and run
indefinitely for an input value of zero, while trying to access
non-existing array members."
--
pete
.
- Follow-Ups:
- Re: How do I convert an int to binary form?
- From: CBFalconer
- Re: How do I convert an int to binary form?
- References:
- How do I convert an int to binary form?
- From: cedarson
- Re: How do I convert an int to binary form?
- From: Joe Wright
- Re: How do I convert an int to binary form?
- From: Keith Thompson
- Re: How do I convert an int to binary form?
- From: Joe Wright
- Re: How do I convert an int to binary form?
- From: Keith Thompson
- Re: How do I convert an int to binary form?
- From: Joe Wright
- Re: How do I convert an int to binary form?
- From: pete
- Re: How do I convert an int to binary form?
- From: CBFalconer
- Re: How do I convert an int to binary form?
- From: CBFalconer
- Re: How do I convert an int to binary form?
- From: pete
- Re: How do I convert an int to binary form?
- From: CBFalconer
- How do I convert an int to binary form?
- Prev by Date: Fast 1D DCT Implementation in C/C++
- Next by Date: Re: Spaces in C
- Previous by thread: Re: How do I convert an int to binary form?
- Next by thread: Re: How do I convert an int to binary form?
- Index(es):
Relevant Pages
|
Loading