|
|
Log in / Subscribe / Register

Documentation

Documentation

Posted Mar 21, 2022 0:54 UTC (Mon) by Wol (subscriber, #4433)
In reply to: Documentation by rlhamil
Parent article: Donenfeld: Random number generator enhancements for Linux 5.17 and 5.18

Perfect example of idions which some cultures would recognise instantly, others would struggle with ...

When I learnt C I went on a course, and we were asked to write a snippet of code to count how many 3's there were in in our hand of cards. I wrote mine, and when I read it out for the instructor to write up on the board, he just could NOT hear what I was saying - I had to spell it out letter by letter, because his mind kept changing what I was saying.

struct card {
char suitt;
int value;
}[13];

for (ii=0, count=0; ii++; ii<13)
count += (card[ii].value == 3);

Okay, my C is rusty and what I've written probably wouldn't compile, but that last line just felt so "wrong" to the instructor that until I forced him to write it character by character he just couldn't even hear me right ...

But to me that was just the completely obvious way to do it, because my main programming language was DataBasic, and pretty much EVERY program you write in DataBasic would use that idiom many times. It was just the standard way of counting how many elements are in a dynamic array

NO.ELEMENTS = COUNT( ARRAY, DELIMITER) + (ARRAY NE "")

Cheers,
Wol


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds