on writing a while loop for rolling two dice

Hope Rouselle hrouselle at jevedi.com
Tue Sep 7 14:58:29 EDT 2021


Grant Edwards <grant.b.edwards at gmail.com> writes:

> On 2021-09-06, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
>> "Avi Gross" <avigross at verizon.net> writes:
>>> In languages like C/C++ there are people who make up macros like:
>>>#define INDEFINITELY_LOOP while (true)
>>>Or something like that and then allow the preprocessor to replace 
>>>INDEFINITELY_LOOP with valid C code.
>>
>>   Those usually are beginners.

[...]

>>   Such a use of macros is frowned upon by most C programmers,
>>   because it renders the code unreadable.
>
> I remember engineering manager I worked with about 35 years ago who
> used a set of C macros to try to make his code look as much like BASIC
> as possible:
>
>   #define IF if (
>   #define THEN ) {
>   #define ELSE } else {
>   #define ENDIF }
>   ...
>
> IIRC he copied them out of a magazine article.
>
> He then proceeded to try to implement a tree search algorithm (he
> didn't actually know that's what he was doing) using his new
> "language" without using recursion (which he had never heard of and
> couldn't grok) by keeping track of state using an array. It did not go
> well and made him a bit of a laughingstock. IIRC, he had first tried
> to write it in actual BASIC, but gave up on that before switching to C
> and his ridiculous macro set.

LOL!  (Had fun reading this.)


More information about the Python-list mailing list