On 12/08/2024 01:43, Tim Rentsch wrote:
Also, it would be better for your understanding of C if you would
stop thinking about what is going on at the level of actual
hardware. Doing that serves to confuse a lot more than it helps.
I think I feel my ears burning!
Vir Campestris <vir.campestris@invalid.invalid> writes:[snip]
On 12/08/2024 01:43, Tim Rentsch wrote:[...]
Also, it would be better for your understanding of C if you would
stop thinking about what is going on at the level of actual
hardware. Doing that serves to confuse a lot more than it helps.
I think I feel my ears burning!
I'm taking that as a compliment. :)
Also as an impetus to post a small C exercise I've been meaning
to put up.
The goal is to write a C function to compute a signum() value:
long
signum( long k ){
/* should return
* -1 if k < 0
* +1 if k > 0
* 0 otherwise
**/
/* ... */
return 0; /* appropriate return value to be supplied */
}
On Mon, 12 Aug 2024 08:17:11 -0700, Tim Rentsch wrote:
Vir Campestris <vir.campestris@invalid.invalid> writes:
On 12/08/2024 01:43, Tim Rentsch wrote:
[...]
Also, it would be better for your understanding of C if you would
stop thinking about what is going on at the level of actual
hardware. Doing that serves to confuse a lot more than it helps.
I think I feel my ears burning!
I'm taking that as a compliment. :)
Also as an impetus to post a small C exercise I've been meaning
to put up.
The goal is to write a C function to compute a signum() value:
long
signum( long k ){
/* should return
* -1 if k < 0
* +1 if k > 0
* 0 otherwise
**/
/* ... */
return 0; /* appropriate return value to be supplied */
}
[snip]
Didn't we do something like this a few years ago, when someone
complained that strcmp() did /not/ return -1, 0, or +1 on
lessthan, equalto, or greaterthan string comparisons?
If I still have my "solution" around, I'll post it to followup
the more current solutions.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 05:12:46 |
Calls: | 10,386 |
Calls today: | 1 |
Files: | 14,058 |
Messages: | 6,416,629 |