Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman Newsgroups: alt.folklore.computers,comp.os.linux.misc Subject: Re: The joy of FORTRAN Date: 1 Mar 2025 04:35:48 GMT Lines: 45 Message-ID: References: <59CJO.19674$MoU3.15170@fx36.iad> <3hOdnWpQ649QMGr7nZ2dnZfqnPidnZ2d@earthlink.com> <1smdnSjX3YoxgWf7nZ2dnZfqn_idnZ2d@earthlink.com> <1396870532.749421730.052473.peter_flass-yahoo.com@news.eternal-september.org> <1214951717.762291306.657281.peter_flass-yahoo.com@news.eternal-september.org> <1698682867.762482332.128555.peter_flass-yahoo.com@news.eternal-september.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net bSHE6XvHa1V8Y5ajBCtHlwYLg265piSNdEpeE9obL5/5O1ACf/ Cancel-Lock: sha1:DquO20xCSfpjn2V9rrwjG8F0+P4= sha256:Sw8CkH9+SFZURQItTOl8k7EfIwxng+Hy7mgglU2Q/1c= User-Agent: Pan/0.160 (Toresk; ) Bytes: 2951 On Fri, 28 Feb 2025 17:47:19 -0700, Peter Flass wrote: > Imported one C program that was all macros. In hindsight it would have > been better just to rewrite it. The one I'm thinking of had gems like #define STRF_FN_DECL(obj) \ size_t strf_##obj (char *obuf, size_t olen, const char *fmt, \ void *data, list_t *list) #define STRF_FN(obj) \ STRF_FN_DECL(obj) \ { \ static list_t llist; \ static struct obj##_struct o; \ \ if (list == NULL || list->data == NULL) { \ if ( data) { \ memcpy(&o, data, sizeof(o)); \ } else { \ memset(&o, 0, sizeof(o)); \ } \ if ( list ) { \ llist = *list; \ } \ llist.data = (void*)&o; \ list = &llist; \ } \ return (strfobj (list->data, list, obj##_map, obuf, olen, fmt)); \ } #define MAP(nm,s,fmt,fn,sm, sfn) { #s, sizeof (#s)-1, \ offsetof (struct nm##_struct, s), fmt, fn, sm, sfn } Between the stringizing and concatenation operators good luck finding a function that did stuff with foo. Using 4 characters was an extravagance; most of his code didn't exceed 3 characters for variable names. Now the irony: he had been a TA at UM and students who had him said he was a stickler for well commented code. He personally never commented a line of code as far as I could tell.