How do I convert an int to binary form?

C

CBFalconer

CBFalconer said:
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 ...

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

--
"The power of the Executive to cast a man into prison without
formulating any charge known to the law, and particularly to
deny him the judgement of his peers, is in the highest degree
odious and is the foundation of all totalitarian government
whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
 
P

pete

CBFalconer said:
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
 
C

CBFalconer

pete said:
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. If
you disagree go ahead and quote and argue out in the open.

--
"The power of the Executive to cast a man into prison without
formulating any charge known to the law, and particularly to
deny him the judgement of his peers, is in the highest degree
odious and is the foundation of all totalitarian government
whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
 
P

pete

CBFalconer said:
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."
 
C

CBFalconer

pete said:
CBFalconer said:
pete said:
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."

Allright. You have shown that I can repeat my mistakes. It also
shows that conditionals with side effects can be obfuscating.
However there was nothing wrong with my suggested replacement code,
and it required little examination to convince the reader of
correctness.

--
"The power of the Executive to cast a man into prison without
formulating any charge known to the law, and particularly to
deny him the judgement of his peers, is in the highest degree
odious and is the foundation of all totalitarian government
whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top