Thread View: comp.lang.c++
529 messages
529 total messages
Page 2 of 11
Started by Lynn McGuire
Wed, 14 Oct 2026 04:18
Page 2 of 11 • 529 total messages
Re: “The end of software secrecy is almost upon us"
Author: William Hyde
Date: Tue, 20 Oct 2026 18:36
Date: Tue, 20 Oct 2026 18:36
44 lines
3138 bytes
3138 bytes
Cryptoengineer wrote: > On 10/20/2026 1:46 AM, Titus G wrote: >> On 20/10/2026 18:28, Thomas Koenig wrote: >>> Scott Dorsey <kludge@panix.com> schrieb: >>>> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>>>> One of the things that I am enjoying is that F2C gets rid of about 75% >>>>> of the Fortran Gotos. The remaining 25% Gotos usually make some >>>>> sense. >>>>> Ok, a little sense that any C or C++ programmer would have never >>>>> used a >>>>> goto there. >>>> >>>> It drives me up the wall when people use a goto to jump out of a do >>>> loop. >>>> The compiler is doing so much cleanup work that the programmer never >>>> sees. >>> >>> Again, care to give an example? >> >> I thought that what was called Structured Programming became an >> inviolable law when invented by whom I do not know but suspect that >> bugger for the bottle or even earlier. > > ITYM: > > Edgar Dijkstra: Go To Statement Considered Harmful > > https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf > First year computer science prof: "When I first learned to program I thanked god for the goto statement. Now I hate the very sight of it". Luckily I took German instead. My own code was liberally festooned with goto statments, but as far as I can recall I never put a pointer in common. Using goto to exit loops? I can't recall doing that. But I can't rule it out. William Hyde
Re: “The end of software secrecy is almost upon us"
Author: William Hyde
Date: Tue, 20 Oct 2026 18:48
Date: Tue, 20 Oct 2026 18:48
42 lines
3379 bytes
3379 bytes
Scott Dorsey wrote: > Lynn McGuire <lynnmcguire5@gmail.com> wrote: >> On 10/19/2026 5:57 PM, Scott Dorsey wrote: >>> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>>> One of the things that I am enjoying is that F2C gets rid of about 75% >>>> of the Fortran Gotos. The remaining 25% Gotos usually make some sense. >>>> Ok, a little sense that any C or C++ programmer would have never used a >>>> goto there. >>> >>> It drives me up the wall when people use a goto to jump out of a do loop. >>> The compiler is doing so much cleanup work that the programmer never sees. >> >> Why do you care about unseen work that the compiler is doing? I >> guarantee that most programmers in these 64 bit days do not care. > > Because I want my code to run fast! I do very much seem to be in the > minority today, it is true. We simply didn't have the computer resources to run my PhD code normally. I spoke to more experienced programmers and learned many tricks to speed things up. This probably knocked a year off my PhD, to the great benefit of my sanity and financial health. And in climate modelling, these tricks proved useful again and again. A month spent optimizing code could save a year on a big project. We were always pushing the limits of whatever our computers could do. The first general circulation model I worked with was a spectral model using spherical harmonics out to order twenty or so. The last went to order 178. Give us a faster computer and we'll bog it down immediately. Mind you the movie of the T178 storm tracks in the last ice age was a wonder to behold. As a coder I was at best 3/10 in scientific code. At accelerating scientific code, maybe 5. At game development, 0.01. William Hyde
Re: “The end of software secrecy is almost upon
Author: David Brown
Date: Tue, 20 Oct 2026 18:50
Date: Tue, 20 Oct 2026 18:50
35 lines
3269 bytes
3269 bytes
On 20/10/2026 19:24, boltar@battlestar.co.uk wrote: > On Tue, 20 Oct 2026 17:15:28 -0000 (UTC) > Thomas Koenig <tkoenig@netcologne.de> wrote: >> Lynn McGuire <lynnmcguire5@gmail.com> schrieb: >>> On 10/19/2026 5:57 PM, Scott Dorsey wrote: >>>> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>>>> One of the things that I am enjoying is that F2C gets rid of about 75% >>>>> of the Fortran Gotos. The remaining 25% Gotos usually make some sense. >>>>> Ok, a little sense that any C or C++ programmer would have never used a >>>>> goto there. >>>> >>>> It drives me up the wall when people use a goto to jump out of a do loop. >>>> The compiler is doing so much cleanup work that the programmer never sees. >> >> I'd really like to know what that cleanup work is supposed to be (as >> somebody who is involved with Fortran compiler development). > > If C/C++ had multi level break and continue keywords goto would almost > never be needed**. There's no reason they can't be added - along with a lot of > other useful but basic fatures (eg non POD switch, native concatting numbers to > std::string without calling to_string) - but I guess the committee are too busy > circle jerking with esoteric crap no one will ever use (eg concepts) to bother. > Multi-level break and continue (named loops) is on its way to C++, and will almost certainly be accepted sooner or later (since it is already in the draft of the next C standard): <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3568r0.html> And people /do/ use concepts, even if you do not. You might want to do some research before insulting the people who are actually doing the work in driving languages forward.
Re: “The end of software secrecy is almost upon
Author: Charlie Gibbs
Date: Tue, 20 Oct 2026 19:04
Date: Tue, 20 Oct 2026 19:04
41 lines
2738 bytes
2738 bytes
On 2026-10-20, boltar@battlestar.co.uk <boltar@battlestar.co.uk> wrote: > On Tue, 20 Oct 2026 13:20:40 -0400 > > Cryptoengineer <petertrei@gmail.com> wrote: > >> On 10/20/2026 1:46 AM, Titus G wrote: >> >>> I thought that what was called Structured Programming became an >>> inviolable law when invented by whom I do not know but suspect that >>> bugger for the bottle or even earlier. >> >> ITYM: >> >> Edgar Dijkstra: Go To Statement Considered Harmful > > A man who clearly never programmed in assembler. Of course. He was a CS weenie - any mention of low-level programming makes those types turn purple. Although Structured Programming introduced some good concepts, it also built a following of fanatics more bent on crucifying infidels than writing good practical programs. Some people came to see the number of function calls a program made as a figure of merit, resulting in dozens of tiny functions that caused control to jump all over the place (which made virtual memory systems thrash). And the end result wasn't that much more readable. The undisciplined use of GOTOs is bad, agreed. But the undisciplined use of function calls isn't a whole lot better. After all, a function call is just a GOTO paired with a "come from", so in the end it's all still spaghetti code - it's just that the "structured" code runs double strands. -- /~\ Charlie Gibbs | In this world there are \ / <cgibbs@kltpzyxm.invalid> | two kinds of people: X I'm really at ac.dekanfrus | 1. Those who can extrapolate / \ if you read it the right way. | from incomplete data.
Re: “The end of software secrecy is almost upon us"
Author: Peter Flass
Date: Tue, 20 Oct 2026 19:10
Date: Tue, 20 Oct 2026 19:10
48 lines
3758 bytes
3758 bytes
On 10/20/26 10:15, Thomas Koenig wrote: > Lynn McGuire <lynnmcguire5@gmail.com> schrieb: >> On 10/19/2026 5:57 PM, Scott Dorsey wrote: >>> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>>> One of the things that I am enjoying is that F2C gets rid of about 75% >>>> of the Fortran Gotos. The remaining 25% Gotos usually make some sense. >>>> Ok, a little sense that any C or C++ programmer would have never used a >>>> goto there. >>> >>> It drives me up the wall when people use a goto to jump out of a do loop. >>> The compiler is doing so much cleanup work that the programmer never sees. > > I'd really like to know what that cleanup work is supposed to be (as > somebody who is involved with Fortran compiler development). > > I am beginning to suspect that Scott is the only person in the > world who sees this supposed inefficiency. > >>> --scott >> >> Why do you care about unseen work that the compiler is doing? I >> guarantee that most programmers in these 64 bit days do not care. > > For very many problems, there is no need to be efficient - it very > certainly does not matter if a program that is executed once takes > 0.01 s or 0.1s. > > But the attitude of not caring about speed can have grave results > when the inefficiencies pile up. People who use Python for > everything may find that instead of 0.1 s, their code suddenly > runs for hours, when it would need seconds in a compiled language. > > Or look at the pile of resource-wasting junk like Microsoft > Teams runnig on top of the pile of resource-wasting junk called > Microsoft Windows. Teams grabs a humungous amount of memory so 16 > GB is borderline unusable in a commercial enviroment. Makes the > recent memory price hike all the more interesting... > > Don't know about your code, but I remember waiting a long time > for Aspen simulations... but then again, those diverge from > a converged solution, which shows that if Aspen has the first > clue about numerical methods, they are very good at hiding it. > > I just hope your software is better, at least in that respect. > If there is any work to do, the compiler should also be able to do it in the case of a GOTO out of a loop.
Re: “The end of software secrecy is almost upon
Author: Peter Flass
Date: Tue, 20 Oct 2026 19:11
Date: Tue, 20 Oct 2026 19:11
27 lines
2971 bytes
2971 bytes
On 10/20/26 10:24, boltar@battlestar.co.uk wrote: > On Tue, 20 Oct 2026 17:15:28 -0000 (UTC) > Thomas Koenig <tkoenig@netcologne.de> wrote: >> Lynn McGuire <lynnmcguire5@gmail.com> schrieb: >>> On 10/19/2026 5:57 PM, Scott Dorsey wrote: >>>> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>>>> One of the things that I am enjoying is that F2C gets rid of about 75% >>>>> of the Fortran Gotos. The remaining 25% Gotos usually make some sense. >>>>> Ok, a little sense that any C or C++ programmer would have never used a >>>>> goto there. >>>> >>>> It drives me up the wall when people use a goto to jump out of a do loop. >>>> The compiler is doing so much cleanup work that the programmer never sees. >> >> I'd really like to know what that cleanup work is supposed to be (as >> somebody who is involved with Fortran compiler development). > > If C/C++ had multi level break and continue keywords goto would almost > never be needed**. There's no reason they can't be added - along with a lot of > other useful but basic fatures (eg non POD switch, native concatting numbers to > std::string without calling to_string) - but I guess the committee are too busy > circle jerking with esoteric crap no one will ever use (eg concepts) to bother. > > ** The setting a flag method which has to be checked in every nested loop test > is just an assinine way to code. They just keep trying to re-invert PL/I.
Re: “The end of software secrecy is almost upon
Author: Thomas Koenig
Date: Tue, 20 Oct 2026 19:54
Date: Tue, 20 Oct 2026 19:54
34 lines
2601 bytes
2601 bytes
Charlie Gibbs <cgibbs@kltpzyxm.invalid> schrieb: > On 2026-10-20, boltar@battlestar.co.uk <boltar@battlestar.co.uk> wrote: > >> On Tue, 20 Oct 2026 13:20:40 -0400 >> >> Cryptoengineer <petertrei@gmail.com> wrote: >> >>> On 10/20/2026 1:46 AM, Titus G wrote: >>> >>>> I thought that what was called Structured Programming became an >>>> inviolable law when invented by whom I do not know but suspect that >>>> bugger for the bottle or even earlier. >>> >>> ITYM: >>> >>> Edgar Dijkstra: Go To Statement Considered Harmful >> >> A man who clearly never programmed in assembler. > > Of course. He was a CS weenie - any mention of low-level > programming makes those types turn purple. Nonsense. Dijstra started programming in 1951, they didn't even have assemblers on the machines, it was pretty much naked machine code. Whatever else his faults may have been (arrogance certainly being among them), he was no stranger to low-level programming. -- This USENET posting was made without artificial intelligence, artificial impertinence, artificial arrogance, artificial stupidity, artificial flavorings or artificial colorants.
Re: “The end of software secrecy is almost upon
Author: Lawrence D’Oliveiro
Date: Tue, 20 Oct 2026 20:00
Date: Tue, 20 Oct 2026 20:00
18 lines
2311 bytes
2311 bytes
On Tue, 20 Oct 2026 19:04:55 GMT, Charlie Gibbs wrote: > The undisciplined use of GOTOs is bad, agreed. Is there such a thing as a *disciplined* use of gotos? I find the C code I write tends to do a lot of dynamic resource allocations. These can sometimes fail with errors. So error recovery will invariably involve cleaning up those parts of the allocations which already succeeded. Gotos are no good for this; you need to exit levels of structure nesting one by one, disposing of allocations as you go. I put together an example here <https://gitlab.com/ldo/a_structured_discipline_of_programming>. This is an extension module that offers services to Python code, because that is just about the worst example I could think of, for those who think gotos can cut it.
Re: “The end of software secrecy is almost upon
Author: Lynn McGuire
Date: Tue, 20 Oct 2026 20:06
Date: Tue, 20 Oct 2026 20:06
24 lines
2429 bytes
2429 bytes
On 10/20/2026 1:22 PM, Scott Dorsey wrote: > In article <11b8b2k$p44i$1@dont-email.me>, <boltar@battlestar.co.uk> wrote: >> Cryptoengineer <petertrei@gmail.com> wrote: >>> Edgar Dijkstra: Go To Statement Considered Harmful >> >> A man who clearly never programmed in assembler. > > I have seen a structured assembler class and it's actually not a bad way > to think at all. Having LOOPZ and REP* and similar instructions make it > easier to think about do loops. > > The key to writing structured assembly is commenting. > --scott The key to writing any software is lots of commenting. About a third of my calculation engine was written pre 1978 (250,000 lines of Fortran 66 code) and that code cost us money to sit on a drum drive on a Univac 1108. So no comments for that code except where somebody came along and threw something in there after 1977. Sometimes the later comments are correct, sometimes the later comments are wrong. Lynn
Re: “The end of software secrecy is almost upon us"
Author: Lynn McGuire
Date: Tue, 20 Oct 2026 20:20
Date: Tue, 20 Oct 2026 20:20
64 lines
4537 bytes
4537 bytes
On 10/20/2026 12:15 PM, Thomas Koenig wrote: > Lynn McGuire <lynnmcguire5@gmail.com> schrieb: >> On 10/19/2026 5:57 PM, Scott Dorsey wrote: >>> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>>> One of the things that I am enjoying is that F2C gets rid of about 75% >>>> of the Fortran Gotos. The remaining 25% Gotos usually make some sense. >>>> Ok, a little sense that any C or C++ programmer would have never used a >>>> goto there. >>> >>> It drives me up the wall when people use a goto to jump out of a do loop. >>> The compiler is doing so much cleanup work that the programmer never sees. > > I'd really like to know what that cleanup work is supposed to be (as > somebody who is involved with Fortran compiler development). > > I am beginning to suspect that Scott is the only person in the > world who sees this supposed inefficiency. > >>> --scott >> >> Why do you care about unseen work that the compiler is doing? I >> guarantee that most programmers in these 64 bit days do not care. > > For very many problems, there is no need to be efficient - it very > certainly does not matter if a program that is executed once takes > 0.01 s or 0.1s. > > But the attitude of not caring about speed can have grave results > when the inefficiencies pile up. People who use Python for > everything may find that instead of 0.1 s, their code suddenly > runs for hours, when it would need seconds in a compiled language. > > Or look at the pile of resource-wasting junk like Microsoft > Teams runnig on top of the pile of resource-wasting junk called > Microsoft Windows. Teams grabs a humungous amount of memory so 16 > GB is borderline unusable in a commercial enviroment. Makes the > recent memory price hike all the more interesting... > > Don't know about your code, but I remember waiting a long time > for Aspen simulations... but then again, those diverge from > a converged solution, which shows that if Aspen has the first > clue about numerical methods, they are very good at hiding it. > > I just hope your software is better, at least in that respect. Most of our convergence methods use Newton-Raphson, yes that Isaac Newton, to start, very quick to solve if it solves. If that spirals out of control then we use the halving method, brute force and very slow. If that fails then we use an interpolation method, also very slow. If that fails (the flash is infeasible), then we report the failure to the user. Our rigorous four phase flash is the worst since it solves two sets of k-values simultaneously with a vapor-liquid-solid fugacity based solid flash. The four phases are vapor, hydrocarbon liquid, aqueous liquid, and solid. Almost 300,000 lines of Fortran 66/77 code that I am converting to C++. And there are exceptions all over the place to the above since our software is Frankenstein consisting of the Design, Distill, Refine, and Gasplant Plus programs merged together. Lynn
Re: “The end of software secrecy is almost upon
Author: Lawrence D’Oliveiro
Date: Tue, 20 Oct 2026 20:20
Date: Tue, 20 Oct 2026 20:20
33 lines
2756 bytes
2756 bytes
On Tue, 20 Oct 2026 15:06:48 -0500, Lynn McGuire wrote:
> The key to writing any software is lots of commenting.
A key point about comments is they should explain *why* the code is
doing what it’s doing, not simply repeat *what* it is doing. E.g.
watcher = inotify.Watcher.create()
watching = {}
# Monitor immediate containing directories for possibility of files
# disappearing, assuming those directories will not themselves disappear!
FILE_EVENTS = \
{ # watch for the file itself changing or disappearing
IN_BIT.CLOSE_WRITE,
IN_BIT.DELETE_SELF,
IN_BIT.MOVE_SELF,
IN_BIT.MASK_CREATE, # files mustn’t be the same!
}
for key in path_keys :
path = config[key]
parent = os.path.dirname(path) # assumes I don’t need to normalize path
watching[path] = watcher.watch(path, FILE_EVENTS)
# plus a watch on parent directory for disappeared file coming back:
# (This won’t work if file was symlinked; do I care?)
if parent not in watching :
# files will typically be in same directory
watching[parent] = watcher.watch \
(
parent,
{IN_BIT.CREATE, IN_BIT.MOVED_TO, IN_BIT.ONLYDIR}
)
#end if
#end for
Re: “The end of software secrecy is almost upon
Author: Cryptoengineer
Date: Tue, 20 Oct 2026 20:40
Date: Tue, 20 Oct 2026 20:40
20 lines
2069 bytes
2069 bytes
On 10/20/2026 2:22 PM, Scott Dorsey wrote: > In article <11b8b2k$p44i$1@dont-email.me>, <boltar@battlestar.co.uk> wrote: >> Cryptoengineer <petertrei@gmail.com> wrote: >>> Edgar Dijkstra: Go To Statement Considered Harmful >> >> A man who clearly never programmed in assembler. > > I have seen a structured assembler class and it's actually not a bad way > to think at all. Having LOOPZ and REP* and similar instructions make it > easier to think about do loops. > > The key to writing structured assembly is commenting. The key to writing [] assembly is commenting. Fixed That For You. pt
Re: Re: “The end of software secrecy is almost upon us"
Author: Scott Dorsey
Date: Tue, 20 Oct 2026 20:41
Date: Tue, 20 Oct 2026 20:41
43 lines
2736 bytes
2736 bytes
Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> wrote: >On 10/20/2026 9:39 PM, Scott Dorsey wrote: >> Because I want my code to run fast! I do very much seem to be in the >> minority today, it is true. > >I presume you're working on some /hot code/, and will comment according- >ly. It's not super hot, but it's often pretty dense dsp stuff and requires extensive commenting to describe exactly what equations are for and how they are being used. Unfortunately so much of the code I deal with has comments like C BRAINDAMAGE! ROCKWELL-COLLINS BRAINDAMAGE! Which are expressive and they are good warnings that something is about to follow which has to do with hardware design deficiencies but not actually very informative about what they are. >I've come across complaints -- that I don't have handy -- that compilers >sometimes under-optimize, or otherwise cannot be told to do the right >thing. One memorable complaint was the inability of then-GCC to align >a specific loop to the cache -- I believe a 16 byte boundary -- it was >only everything -- with the resulting drop in performance everywhere >else -- or nothing because there was no #pragma nor [[attribute]] to say >/this loop needs to be cache aligned/. There used to be a lot of complaints like that around here, but these days gcc is so much better than it was even a decade ago. The new gfortran is not perfect but it's entirely acceptable and takes advantage of the good backend developed for gcc. The older g77 was excruciating. I'd read the .a files that came out and just want to hit my head on the desk. >What do you do in these circumstances? Has this happened to you at all? I go home and I have a drink and I try not to think about it. Yes, it could run a lot better but.... --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis."
Re: Re: “The end of software secrecy is almost upon
Author: Scott Lurndal
Date: Tue, 20 Oct 2026 20:49
Date: Tue, 20 Oct 2026 20:49
35 lines
2485 bytes
2485 bytes
boltar@battlestar.co.uk writes: >On Tue, 20 Oct 2026 13:20:40 -0400 >Cryptoengineer <petertrei@gmail.com> wrote: >>On 10/20/2026 1:46 AM, Titus G wrote: >>> On 20/10/2026 18:28, Thomas Koenig wrote: >>>> Scott Dorsey <kludge@panix.com> schrieb: >>>>> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>>>>> One of the things that I am enjoying is that F2C gets rid of about 75% >>>>>> of the Fortran Gotos. The remaining 25% Gotos usually make some sense. >>>>>> Ok, a little sense that any C or C++ programmer would have never used a >>>>>> goto there. >>>>> >>>>> It drives me up the wall when people use a goto to jump out of a do loop. >>>>> The compiler is doing so much cleanup work that the programmer never sees. >>>> >>>> Again, care to give an example? >>> >>> I thought that what was called Structured Programming became an >>> inviolable law when invented by whom I do not know but suspect that >>> bugger for the bottle or even earlier. >> >>ITYM: >> >>Edgar Dijkstra: Go To Statement Considered Harmful > >A man who clearly never programmed in assembler. > Actually, it's highly likely he did program in assembler. He was a Burroughs fellow for a decade however, working on the large systems family which did not have an assembler - flavors of Algol were the only way to write systems (e.g. MCP) code.
Re: “The end of software secrecy is almost upon
Author: Cryptoengineer
Date: Tue, 20 Oct 2026 20:49
Date: Tue, 20 Oct 2026 20:49
35 lines
2772 bytes
2772 bytes
On 10/20/2026 3:04 PM, Charlie Gibbs wrote: > On 2026-10-20, boltar@battlestar.co.uk <boltar@battlestar.co.uk> wrote: > >> On Tue, 20 Oct 2026 13:20:40 -0400 >> >> Cryptoengineer <petertrei@gmail.com> wrote: >> >>> On 10/20/2026 1:46 AM, Titus G wrote: >>> >>>> I thought that what was called Structured Programming became an >>>> inviolable law when invented by whom I do not know but suspect that >>>> bugger for the bottle or even earlier. >>> >>> ITYM: >>> >>> Edgar Dijkstra: Go To Statement Considered Harmful >> >> A man who clearly never programmed in assembler. > > Of course. He was a CS weenie - any mention of low-level > programming makes those types turn purple. > There was one time when I wrote 6502 assembler including self-modifying code. That would have made them turn ultraviolet. The 6502 had some indexed load and store instructions, where the instruction contained a base address, which was indexed with a register. To deal with a big array (bitmap of the Apple ][ HIRES screen), I wrote code that modified the base address in the instruction. Of course, I was careful to reset it when done. pt
Re: “The end of software secrecy is almost upon us"
Author: Cryptoengineer
Date: Tue, 20 Oct 2026 21:03
Date: Tue, 20 Oct 2026 21:03
25 lines
2534 bytes
2534 bytes
On 10/20/2026 1:48 AM, Lynn McGuire wrote: > On 10/19/2026 5:57 PM, Scott Dorsey wrote: >> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>> One of the things that I am enjoying is that F2C gets rid of about 75% >>> of the Fortran Gotos. The remaining 25% Gotos usually make some sense. >>> Ok, a little sense that any C or C++ programmer would have never used a >>> goto there. >> >> It drives me up the wall when people use a goto to jump out of a do loop. >> The compiler is doing so much cleanup work that the programmer never >> sees. >> --scott > > Why do you care about unseen work that the compiler is doing? I > guarantee that most programmers in these 64 bit days do not care. One side project I worked on at RSA (managing a crowd sourced effort to crack symmetric keys to push policy on exportable key length) used literal years of cpu time. Optimizing the code was paramount. At one point, I had the world's fastest implementation of the DES algorithm, though I was soon beaten. pt
Re: “The end of software secrecy is almost upon us"
Author: Thomas Koenig
Date: Tue, 20 Oct 2026 21:20
Date: Tue, 20 Oct 2026 21:20
42 lines
3161 bytes
3161 bytes
Lynn McGuire <lynnmcguire5@gmail.com> schrieb: > On 10/20/2026 12:15 PM, Thomas Koenig wrote: >> Don't know about your code, but I remember waiting a long time >> for Aspen simulations... but then again, those diverge from >> a converged solution, which shows that if Aspen has the first >> clue about numerical methods, they are very good at hiding it. >> >> I just hope your software is better, at least in that respect. > > Most of our convergence methods use Newton-Raphson, yes that Isaac > Newton, to start, very quick to solve if it solves. If that spirals out > of control then we use the halving method, brute force and very slow. > If that fails then we use an interpolation method, also very slow. If > that fails (the flash is infeasible), then we report the failure to the > user. Sounds reasonable, but... How can bisection fail? If you have bracketed your roots and have no singularities it always succeeds. Hmm... molar fractions less than zero, maybe? > Our rigorous four phase flash is the worst since it solves two sets of > k-values simultaneously with a vapor-liquid-solid fugacity based solid > flash. The four phases are vapor, hydrocarbon liquid, aqueous liquid, > and solid. Almost 300,000 lines of Fortran 66/77 code that I am > converting to C++. For two variables, of course, bisection will not work. > And there are exceptions all over the place to the above since our > software is Frankenstein consisting of the Design, Distill, Refine, and > Gasplant Plus programs merged together. I can imagine... -- This USENET posting was made without artificial intelligence, artificial impertinence, artificial arrogance, artificial stupidity, artificial flavorings or artificial colorants.
Re: “The end of software secrecy is almost upon us"
Author: Lynn McGuire
Date: Tue, 20 Oct 2026 21:26
Date: Tue, 20 Oct 2026 21:26
46 lines
3558 bytes
3558 bytes
On 10/20/2026 4:20 PM, Thomas Koenig wrote: > Lynn McGuire <lynnmcguire5@gmail.com> schrieb: >> On 10/20/2026 12:15 PM, Thomas Koenig wrote: > >>> Don't know about your code, but I remember waiting a long time >>> for Aspen simulations... but then again, those diverge from >>> a converged solution, which shows that if Aspen has the first >>> clue about numerical methods, they are very good at hiding it. >>> >>> I just hope your software is better, at least in that respect. >> >> Most of our convergence methods use Newton-Raphson, yes that Isaac >> Newton, to start, very quick to solve if it solves. If that spirals out >> of control then we use the halving method, brute force and very slow. >> If that fails then we use an interpolation method, also very slow. If >> that fails (the flash is infeasible), then we report the failure to the >> user. > > Sounds reasonable, but... > > How can bisection fail? If you have bracketed your roots and > have no singularities it always succeeds. > > Hmm... molar fractions less than zero, maybe? > >> Our rigorous four phase flash is the worst since it solves two sets of >> k-values simultaneously with a vapor-liquid-solid fugacity based solid >> flash. The four phases are vapor, hydrocarbon liquid, aqueous liquid, >> and solid. Almost 300,000 lines of Fortran 66/77 code that I am >> converting to C++. > > For two variables, of course, bisection will not work. > >> And there are exceptions all over the place to the above since our >> software is Frankenstein consisting of the Design, Distill, Refine, and >> Gasplant Plus programs merged together. > > I can imagine... An infeasible problem is impossible to solve but it has to go through all of the solvers before it is declared to be infeasible. We have some quality analysis (Michelson, et al) but if you do quality analysis, you have solved most of the problem already. Lynn
Re: “The end of software secrecy is almost upon
Author: Charlie Gibbs
Date: Tue, 20 Oct 2026 23:18
Date: Tue, 20 Oct 2026 23:18
37 lines
2939 bytes
2939 bytes
On 2026-10-20, Lawrence D’Oliveiro <ldo@nz.invalid> wrote: > On Tue, 20 Oct 2026 19:04:55 GMT, Charlie Gibbs wrote: > >> The undisciplined use of GOTOs is bad, agreed. > > Is there such a thing as a *disciplined* use of gotos? Yes, especially in COBOL or assembly language. For instance, a GOTO to the end of a function ensures any of its cleanup code gets executed, and fulfils a goal of structured proramming: each function has one exit point. > I find the C code I write tends to do a lot of dynamic resource > allocations. These can sometimes fail with errors. So error recovery > will invariably involve cleaning up those parts of the allocations > which already succeeded. Gotos are no good for this; you need to exit > levels of structure nesting one by one, disposing of allocations as > you go. I know that a lot of CS types are going to stick pins into little dolls that look like me for saying this, but IMHO resource pointers, handles, etc. should be global. Possible exceptions are resources that are going to be used solely by the current function - but even then, if that function calls another function that fails horribly, there's stuff that might not get cleaned up. That's why all my C programs contain a function quit_cleanup(char *errmsg), which de-allocates all resources and then exits (displaying "errmsg" if it isn't NULL). I can call that function anywhere, safe in the knowledge that by the time it finishes (it never returns), everything will have be freed. -- /~\ Charlie Gibbs | In this world there are \ / <cgibbs@kltpzyxm.invalid> | two kinds of people: X I'm really at ac.dekanfrus | 1. Those who can extrapolate / \ if you read it the right way. | from incomplete data.
Re: “The end of software secrecy is almost upon
Author: Steven G. Kargl
Date: Tue, 20 Oct 2026 23:20
Date: Tue, 20 Oct 2026 23:20
15 lines
1987 bytes
1987 bytes
On Tue, 20 Oct 2026 20:00:03 -0000 (UTC), Lawrence D’Oliveiro wrote: > On Tue, 20 Oct 2026 19:04:55 GMT, Charlie Gibbs wrote: > >> The undisciplined use of GOTOs is bad, agreed. > > Is there such a thing as a *disciplined* use of gotos? > Yes. D. Knuth, Structured Programming with go to Statements, ACM Computing Surveys (CSUR), Vol 6, Issue 4, Pp 261-301, 1974 https://doi.org/10.1145/356635.356640 -- steve
Re: “The end of software secrecy is almost upon
Author: William Hyde
Date: Tue, 20 Oct 2026 23:32
Date: Tue, 20 Oct 2026 23:32
31 lines
2805 bytes
2805 bytes
Lynn McGuire wrote: > On 10/20/2026 1:22 PM, Scott Dorsey wrote: >> In article <11b8b2k$p44i$1@dont-email.me>, <boltar@battlestar.co.uk> >> wrote: >>> Cryptoengineer <petertrei@gmail.com> wrote: >>>> Edgar Dijkstra: Go To Statement Considered Harmful >>> >>> A man who clearly never programmed in assembler. >> >> I have seen a structured assembler class and it's actually not a bad way >> to think at all. Having LOOPZ and REP* and similar instructions make it >> easier to think about do loops. >> >> The key to writing structured assembly is commenting. >> --scott > > The key to writing any software is lots of commenting. > > About a third of my calculation engine was written pre 1978 (250,000 > lines of Fortran 66 code) and that code cost us money to sit on a drum > drive on a Univac 1108. So no comments for that code except where > somebody came along and threw something in there after 1977. Sometimes > the later comments are correct, sometimes the later comments are wrong. Ah, I do love zombie comments, where someone has changed the code but left the comments as they were. It's my favourite source of new curses. William Hyde
Re: “The end of software secrecy is almost upon us"
Author: Chris M. Thomasson
Date: Tue, 20 Oct 2026 23:48
Date: Tue, 20 Oct 2026 23:48
42 lines
3511 bytes
3511 bytes
On 10/20/2026 1:41 PM, Scott Dorsey wrote: > Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> wrote: >> On 10/20/2026 9:39 PM, Scott Dorsey wrote: >>> Because I want my code to run fast! I do very much seem to be in the >>> minority today, it is true. >> >> I presume you're working on some /hot code/, and will comment according- >> ly. > > It's not super hot, but it's often pretty dense dsp stuff and requires > extensive commenting to describe exactly what equations are for and how > they are being used. > > Unfortunately so much of the code I deal with has comments like > > C BRAINDAMAGE! ROCKWELL-COLLINS BRAINDAMAGE! > > Which are expressive and they are good warnings that something is about > to follow which has to do with hardware design deficiencies but not > actually very informative about what they are. > >> I've come across complaints -- that I don't have handy -- that compilers >> sometimes under-optimize, or otherwise cannot be told to do the right >> thing. One memorable complaint was the inability of then-GCC to align >> a specific loop to the cache -- I believe a 16 byte boundary -- it was >> only everything -- with the resulting drop in performance everywhere >> else -- or nothing because there was no #pragma nor [[attribute]] to say >> /this loop needs to be cache aligned/. > > There used to be a lot of complaints like that around here, but these > days gcc is so much better than it was even a decade ago. The new > gfortran is not perfect but it's entirely acceptable and takes advantage > of the good backend developed for gcc. The older g77 was excruciating. > I'd read the .a files that came out and just want to hit my head on the > desk. > >> What do you do in these circumstances? Has this happened to you at all? > > I go home and I have a drink and I try not to think about it. Yes, it > could run a lot better but.... A drink? Ahh some brain coolants. Well, they are needed from time to time... ;^D
Re: “The end of software secrecy is almost upon
Author: Nuno Silva
Date: Wed, 21 Oct 2026 00:15
Date: Wed, 21 Oct 2026 00:15
50 lines
3470 bytes
3470 bytes
On 2026-10-20, Charlie Gibbs wrote: > On 2026-10-20, boltar@battlestar.co.uk <boltar@battlestar.co.uk> wrote: > >> On Tue, 20 Oct 2026 13:20:40 -0400 >> >> Cryptoengineer <petertrei@gmail.com> wrote: >> >>> On 10/20/2026 1:46 AM, Titus G wrote: >>> >>>> I thought that what was called Structured Programming became an >>>> inviolable law when invented by whom I do not know but suspect that >>>> bugger for the bottle or even earlier. >>> >>> ITYM: >>> >>> Edgar Dijkstra: Go To Statement Considered Harmful >> >> A man who clearly never programmed in assembler. > > Of course. He was a CS weenie - any mention of low-level > programming makes those types turn purple. > > Although Structured Programming introduced some good concepts, > it also built a following of fanatics more bent on crucifying > infidels than writing good practical programs. Some people > came to see the number of function calls a program made as > a figure of merit, resulting in dozens of tiny functions that > caused control to jump all over the place (which made virtual > memory systems thrash). And the end result wasn't that much > more readable. > > The undisciplined use of GOTOs is bad, agreed. But the > undisciplined use of function calls isn't a whole lot better. > After all, a function call is just a GOTO paired with a > "come from", so in the end it's all still spaghetti code - > it's just that the "structured" code runs double strands. The "come from" IIRC is the key part here. If you use a function (and don't goto into its body, as that would undo the benefit here), you can analyze the function as a block with clearly defined flows and separately from the rest of the program. The criticism isn't about not putting everything into its own function, it's about how using functions and other flow control structures instead of e.g. gotos makes it easier to study and reason about these parts of the code. -- Nuno Silva
Re: “The end of software secrecy is almost upon
Author: Lawrence D’Oliveiro
Date: Wed, 21 Oct 2026 01:27
Date: Wed, 21 Oct 2026 01:27
18 lines
2423 bytes
2423 bytes
On Tue, 20 Oct 2026 23:18:44 GMT, Charlie Gibbs wrote: > On 2026-10-20, Lawrence D’Oliveiro <ldo@nz.invalid> wrote: > >> I find the C code I write tends to do a lot of dynamic resource >> allocations. These can sometimes fail with errors. So error >> recovery will invariably involve cleaning up those parts of the >> allocations which already succeeded. Gotos are no good for this; >> you need to exit levels of structure nesting one by one, disposing >> of allocations as you go. > > I know that a lot of CS types are going to stick pins into little > dolls that look like me for saying this, but IMHO resource pointers, > handles, etc. should be global. Surely any variable which is only used locally to a particular block should be declared local to that block. Why should resource pointers be any different?
Re: “The end of software secrecy is almost upon
Author: Lawrence D’Oliveiro
Date: Wed, 21 Oct 2026 01:29
Date: Wed, 21 Oct 2026 01:29
7 lines
1747 bytes
1747 bytes
On Tue, 20 Oct 2026 17:24:27 -0000 (UTC), boltar wrote: > ** The setting a flag method which has to be checked in every nested > loop test is just an [asinine] way to code. If you have to do cleanup at each level before exiting, then it works perfectly well.
Re: “The end of software secrecy is almost upon us"
Author: Lawrence D’Oliveiro
Date: Wed, 21 Oct 2026 01:30
Date: Wed, 21 Oct 2026 01:30
10 lines
1890 bytes
1890 bytes
On Tue, 20 Oct 2026 17:15:28 -0000 (UTC), Thomas Koenig wrote: > But the attitude of not caring about speed can have grave results > when the inefficiencies pile up. That’s not usually how code works, though. Execution time tends to follow a Pareto distribution -- spend your effort on the 10% of the code where 90% of the time is being spent, and that gives significant improvements without having to mess around with the other 90% of the code.
Re: “The end of software secrecy is almost upon us"
Author: Lawrence D’Oliveiro
Date: Wed, 21 Oct 2026 01:35
Date: Wed, 21 Oct 2026 01:35
18 lines
2214 bytes
2214 bytes
On Tue, 20 Oct 2026 15:20:29 -0500, Lynn McGuire wrote: > Most of our convergence methods use Newton-Raphson, yes that Isaac > Newton, to start, very quick to solve if it solves. Second-order convergence. That is, the number of digits of precision roughly doubles on every iteration -- when it works, that is. > If that spirals out of control then we use the halving method, brute > force and very slow. If that fails then we use an interpolation > method, also very slow. If that fails (the flash is infeasible), > then we report the failure to the user. Binary chop gives only first-order convergence, but it is guaranteed to converge if there is an answer. That’s why it’s always the last resort. No love for Runge-Kutta?
Re: “The end of software secrecy is almost upon
Author: Keith Thompson
Date: Wed, 21 Oct 2026 02:06
Date: Wed, 21 Oct 2026 02:06
22 lines
2233 bytes
2233 bytes
David Brown <david.brown@hesbynett.no> writes:
[...]
> Multi-level break and continue (named loops) is on its way to C++, and
> will almost certainly be accepted sooner or later (since it is already
> in the draft of the next C standard):
>
> <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3568r0.html>
Named break and continue are in the latest C2y draft:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3886.pdf
They have been proposed for C++, but as far as I can tell have not
(yet?) been incorporated into a draft C++ standard.
https://github.com/cplusplus/draft
[...]
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: “The end of software secrecy is almost upon us"
Author: Titus G
Date: Wed, 21 Oct 2026 03:11
Date: Wed, 21 Oct 2026 03:11
40 lines
3188 bytes
3188 bytes
On 21/10/2026 06:20, Cryptoengineer wrote: > On 10/20/2026 1:46 AM, Titus G wrote: >> On 20/10/2026 18:28, Thomas Koenig wrote: >>> Scott Dorsey <kludge@panix.com> schrieb: >>>> Lynn McGuire <lynnmcguire5@gmail.com> wrote: >>>>> One of the things that I am enjoying is that F2C gets rid of about 75% >>>>> of the Fortran Gotos. The remaining 25% Gotos usually make some >>>>> sense. >>>>> Ok, a little sense that any C or C++ programmer would have never >>>>> used a >>>>> goto there. >>>> >>>> It drives me up the wall when people use a goto to jump out of a do >>>> loop. >>>> The compiler is doing so much cleanup work that the programmer never >>>> sees. >>> >>> Again, care to give an example? >> >> I thought that what was called Structured Programming became an >> inviolable law when invented by whom I do not know but suspect that >> bugger for the bottle or even earlier. > > ITYM: > > Edgar Dijkstra: Go To Statement Considered Harmful > > https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf > > pt Not Aristotle but the date on that PDF was 1968. Initially we used to write spaghetti in Burroughs Assembler and machine language but after less than a year of my employment, newer larger hardware including a reliable hard disk was purchased by the commercial bureau and everything was rewritten using Structured Programming and COBOL which had a marvellously fast file indexing system and it became possible to read other programmers' programs with such advantages being great for the bureau but not so demanding and therefore rewarding for programmers.
Re: “The end of software secrecy is almost upon
Author: Charlie Gibbs
Date: Wed, 21 Oct 2026 03:22
Date: Wed, 21 Oct 2026 03:22
28 lines
2863 bytes
2863 bytes
On 2026-10-21, Lawrence D’Oliveiro <ldo@nz.invalid> wrote: > On Tue, 20 Oct 2026 23:18:44 GMT, Charlie Gibbs wrote: > >> I know that a lot of CS types are going to stick pins into little >> dolls that look like me for saying this, but IMHO resource pointers, >> handles, etc. should be global. > > Surely any variable which is only used locally to a particular block > should be declared local to that block. Why should resource pointers > be any different? Many resource pointers aren't local, though. Consider a program which loads a table from a file, then uses it for lookups while processing data in another file. You might decompose the program into a function that loads the table, and another that performs lookups. The main routine calls the table load routine, and opens the file to be processed. It then loops reading records, calling the lookup function each time. The table, dynamically allocated by the table load function, must remain allocated when the allocator exits, and must be available to the lookup function on each call; it cannot be local to either of those functions. -- /~\ Charlie Gibbs | In this world there are \ / <cgibbs@kltpzyxm.invalid> | two kinds of people: X I'm really at ac.dekanfrus | 1. Those who can extrapolate / \ if you read it the right way. | from incomplete data.
Re: Re: “The end of software secrecy is almost upon
Author: John Levine
Date: Wed, 21 Oct 2026 03:31
Date: Wed, 21 Oct 2026 03:31
10 lines
1645 bytes
1645 bytes
According to William Hyde <wthyde1953@gmail.com>:
>Ah, I do love zombie comments, where someone has changed the code but
>left the comments as they were.
i += 2; /* add 1 to i */
--
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Re: Re: “The end of software secrecy is almost upon
Author: Ted Nolan <tednolan>
Date: Wed, 21 Oct 2026 04:31
Date: Wed, 21 Oct 2026 04:31
12 lines
1324 bytes
1324 bytes
In article <11b9bn2$28tm$2@gal.iecc.com>, John Levine <johnl@taugh.com> wrote: >According to William Hyde <wthyde1953@gmail.com>: >>Ah, I do love zombie comments, where someone has changed the code but >>left the comments as they were. > > i += 2; /* add 1 to i */ > And then you find out it *does* add 1 to i. Somehow. -- columbiaclosings.com What's not in Columbia anymore..
Re: “The end of software secrecy is almost upon
Author: Lawrence D’Oliveiro
Date: Wed, 21 Oct 2026 05:35
Date: Wed, 21 Oct 2026 05:35
29 lines
3095 bytes
3095 bytes
On Wed, 21 Oct 2026 03:22:12 GMT, Charlie Gibbs wrote: > On 2026-10-21, Lawrence D’Oliveiro <ldo@nz.invalid> wrote: > >> On Tue, 20 Oct 2026 23:18:44 GMT, Charlie Gibbs wrote: >> >>> I know that a lot of CS types are going to stick pins into little >>> dolls that look like me for saying this, but IMHO resource >>> pointers, handles, etc. should be global. >> >> Surely any variable which is only used locally to a particular >> block should be declared local to that block. Why should resource >> pointers be any different? > > Many resource pointers aren't local, though. Consider a program > which loads a table from a file, then uses it for lookups while > processing data in another file. You might decompose the program > into a function that loads the table, and another that performs > lookups. The main routine calls the table load routine, and opens > the file to be processed. It then loops reading records, calling the > lookup function each time. The table, dynamically allocated by the > table load function, must remain allocated when the allocator exits, > and must be available to the lookup function on each call; it cannot > be local to either of those functions. This is why OO was invented. You instantiate a Table instance, and that loads the table contents. Call the lookup method on the instance as many times as you need. Then, when finished with the Table instance, dispose of it.
Re: “The end of software secrecy is almost upon us"
Author: Lawrence D’Oliveiro
Date: Wed, 21 Oct 2026 05:37
Date: Wed, 21 Oct 2026 05:37
11 lines
2021 bytes
2021 bytes
On Wed, 21 Oct 2026 16:11:28 +1300, Titus G wrote: > ... everything was rewritten using Structured Programming and COBOL > which had a marvellously fast file indexing system and it became > possible to read other programmers' programs with such advantages > being great for the bureau but not so demanding and therefore > rewarding for programmers. But then, business procedures moved away from ISAM files to embrace relational databases instead, and it turned out COBOL was a poor fit for managing SQL queries.
Re: “The end of software secrecy is almost upon
Author: boltar
Date: Wed, 21 Oct 2026 07:42
Date: Wed, 21 Oct 2026 07:42
15 lines
1940 bytes
1940 bytes
On Wed, 21 Oct 2026 01:29:18 -0000 (UTC) Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> wrote: >On Tue, 20 Oct 2026 17:24:27 -0000 (UTC), boltar wrote: > >> ** The setting a flag method which has to be checked in every nested >> loop test is just an [asinine] way to code. > >If you have to do cleanup at each level before exiting, then it works >perfectly well. It may well work but it doesn't make it good. Its harder to follow - whereas a goto out of a deeply nested loops is blindingly obvious - and its less efficient.
Re: Re: “The end of software secrecy is almost upon
Author: boltar
Date: Wed, 21 Oct 2026 07:47
Date: Wed, 21 Oct 2026 07:47
37 lines
2942 bytes
2942 bytes
On Tue, 20 Oct 2026 20:50:58 +0200 David Brown <david.brown@hesbynett.no> wrote: >On 20/10/2026 19:24, boltar@battlestar.co.uk wrote: >> If C/C++ had multi level break and continue keywords goto would almost >> never be needed**. There's no reason they can't be added - along with a lot >of >> other useful but basic fatures (eg non POD switch, native concatting numbers >to >> std::string without calling to_string) - but I guess the committee are too >busy >> circle jerking with esoteric crap no one will ever use (eg concepts) to >bother. >> > >Multi-level break and continue (named loops) is on its way to C++, and >will almost certainly be accepted sooner or later (since it is already >in the draft of the next C standard): They should have been added 30 years ago. >And people /do/ use concepts, even if you do not. Yeah, on university CS courses. They're just more metaprogramming fucking about and add nothing of actual value for the jobbing programmer trying to solve a problem. >You might want to do some research before insulting the people who are >actually doing the work in driving languages forward. Driving it forward into a ditch. The language is already so needlessly complicated that students just swerve it for more user friendly ones, mainly Python. And Rust is already nudging C aside. If they ever add a decent object model to it then C++ will be next in the firing line. If I was starting out today in IT I wouldn't touch C++ with the proverbial barge pole.
Re: “The end of software secrecy is almost upon
Author: Lawrence D’Oliveiro
Date: Wed, 21 Oct 2026 07:55
Date: Wed, 21 Oct 2026 07:55
20 lines
2245 bytes
2245 bytes
On Wed, 21 Oct 2026 07:42:30 -0000 (UTC), boltar wrote: > On Wed, 21 Oct 2026 01:29:18 -0000 (UTC), Lawrence D’Oliveiro wrote: >> >> On Tue, 20 Oct 2026 17:24:27 -0000 (UTC), boltar wrote: >> >>> ** The setting a flag method which has to be checked in every >>> nested loop test is just an [asinine] way to code. >> >> If you have to do cleanup at each level before exiting, then it >> works perfectly well. > > It may well work but it doesn't make it good. Its harder to follow - > whereas a goto out of a deeply nested loops is blindingly obvious - > and its less efficient. The goto from the deep inner block to the outer one is “blindingly obvious” ... ly wrong. What about the cleanup?
Re: “The end of software secrecy is almost upon
Author: boltar
Date: Wed, 21 Oct 2026 08:05
Date: Wed, 21 Oct 2026 08:05
30 lines
2547 bytes
2547 bytes
On Wed, 21 Oct 2026 07:55:39 -0000 (UTC) Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> wrote: >On Wed, 21 Oct 2026 07:42:30 -0000 (UTC), boltar wrote: > >> On Wed, 21 Oct 2026 01:29:18 -0000 (UTC), Lawrence D’Oliveiro wrote: >>> >>> On Tue, 20 Oct 2026 17:24:27 -0000 (UTC), boltar wrote: >>> >>>> ** The setting a flag method which has to be checked in every >>>> nested loop test is just an [asinine] way to code. >>> >>> If you have to do cleanup at each level before exiting, then it >>> works perfectly well. >> >> It may well work but it doesn't make it good. Its harder to follow - >> whereas a goto out of a deeply nested loops is blindingly obvious - >> and its less efficient. > >The goto from the deep inner block to the outer one is “blindingly >obvious” ... ly wrong. Fine, well you stick with your gotos-are-bad religious doctrine based on something one guy said 50 years ago and the rest of us will carry on writing usable and easy to follow code. >What about the cleanup? What about it? you think a flag test in a loop automagically fixes that?
Re: “The end of software secrecy is almost upon
Author: Johann 'Myrkraverk' Oskarsson
Date: Wed, 21 Oct 2026 12:09
Date: Wed, 21 Oct 2026 12:09
54 lines
3943 bytes
3943 bytes
On 10/21/2026 7:18 AM, Charlie Gibbs wrote: > On 2026-10-20, Lawrence D’Oliveiro <ldo@nz.invalid> wrote: > >> On Tue, 20 Oct 2026 19:04:55 GMT, Charlie Gibbs wrote: >> >>> The undisciplined use of GOTOs is bad, agreed. >> >> Is there such a thing as a *disciplined* use of gotos? > > Yes, especially in COBOL or assembly language. For instance, > a GOTO to the end of a function ensures any of its cleanup code > gets executed, and fulfils a goal of structured proramming: > each function has one exit point. > >> I find the C code I write tends to do a lot of dynamic resource >> allocations. These can sometimes fail with errors. So error recovery >> will invariably involve cleaning up those parts of the allocations >> which already succeeded. Gotos are no good for this; you need to exit >> levels of structure nesting one by one, disposing of allocations as >> you go. > > I know that a lot of CS types are going to stick pins into little > dolls that look like me for saying this, but IMHO resource pointers, > handles, etc. should be global. Possible exceptions are resources > that are going to be used solely by the current function - but even > then, if that function calls another function that fails horribly, > there's stuff that might not get cleaned up. That's why all my > C programs contain a function quit_cleanup(char *errmsg), which > de-allocates all resources and then exits (displaying "errmsg" > if it isn't NULL). I can call that function anywhere, safe in > the knowledge that by the time it finishes (it never returns), > everything will have be freed. > Side note: I chose not to comment on any of the other followups by the less experienced coders. I personally have no problem with your app- roach. That works for a single process, but once you start making libraries like Lua that can be loaded and then unloaded the rules change somewhat. SQLite3 can be used similarly. Though I doubt many people load either library dynamically, and then un- load; yet as far as I'm aware, both libraries support such usage. I added comp.lang.misc because I'm not aware of a Lua discussion group. Best wishes, and happy resource cleanup! -- Johann | email: invalid -> com | http://www.myrkraverk.com/blog/ I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:; Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
Re: “The end of software secrecy is almost upon us"
Author: Johann 'Myrkraverk' Oskarsson
Date: Wed, 21 Oct 2026 12:21
Date: Wed, 21 Oct 2026 12:21
42 lines
2846 bytes
2846 bytes
On 10/21/2026 9:30 AM, Lawrence D’Oliveiro wrote:
> On Tue, 20 Oct 2026 17:15:28 -0000 (UTC), Thomas Koenig wrote:
>
>> But the attitude of not caring about speed can have grave results
>> when the inefficiencies pile up.
>
> That’s not usually how code works, though. Execution time tends to
> follow a Pareto distribution -- spend your effort on the 10% of the
> code where 90% of the time is being spent, and that gives significant
> improvements without having to mess around with the other 90% of the
> code.
This is true of code. Yet, you can math yourself to a better solution.
The /obvious/ example everyone here knows is sum of integers, as
int sumint( int a ) {
int value = 0 ;
for ( int i = 1 ; i <= a ; i++ )
value += i ;
return value ;
}
whereas a mathematician might code it as
int sumint( int a ) { return a * ( a + 1 ) / 2 ; }
which is much faster for a large a.
The point I'm making here is that if you myopically focus too much on
the hot code, you might miss an obvious mathematical optimization.
I added sci.math in case the wizards there want to add more obvious ex-
amples I may not be aware of.
Best wishes, and happy optimizations!
--
Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | via Easynews.com
https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;
Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
Re: “The end of software secrecy is almost upon
Author: Thomas Koenig
Date: Wed, 21 Oct 2026 13:27
Date: Wed, 21 Oct 2026 13:27
29 lines
2592 bytes
2592 bytes
Lawrence D’Oliveiro <ldo@nz.invalid> schrieb: > On Wed, 21 Oct 2026 07:42:30 -0000 (UTC), boltar wrote: > >> On Wed, 21 Oct 2026 01:29:18 -0000 (UTC), Lawrence D’Oliveiro wrote: >>> >>> On Tue, 20 Oct 2026 17:24:27 -0000 (UTC), boltar wrote: >>> >>>> ** The setting a flag method which has to be checked in every >>>> nested loop test is just an [asinine] way to code. >>> >>> If you have to do cleanup at each level before exiting, then it >>> works perfectly well. >> >> It may well work but it doesn't make it good. Its harder to follow - >> whereas a goto out of a deeply nested loops is blindingly obvious - >> and its less efficient. > > The goto from the deep inner block to the outer one is “blindingly > obvious” ... ly wrong. > > What about the cleanup? What cleanup, exactly? We are talking Fortran, remember. -- This USENET posting was made without artificial intelligence, artificial impertinence, artificial arrogance, artificial stupidity, artificial flavorings or artificial colorants.
Re: “The end of software secrecy is almost upon
Author: Peter Flass
Date: Wed, 21 Oct 2026 14:37
Date: Wed, 21 Oct 2026 14:37
9 lines
1685 bytes
1685 bytes
On 10/20/26 20:31, John Levine wrote: > According to William Hyde <wthyde1953@gmail.com>: >> Ah, I do love zombie comments, where someone has changed the code but >> left the comments as they were. > > i += 2; /* add 1 to i */ > LOL!
Re: “The end of software secrecy is almost upon
Author: Peter Flass
Date: Wed, 21 Oct 2026 14:41
Date: Wed, 21 Oct 2026 14:41
35 lines
3078 bytes
3078 bytes
On 10/21/26 01:05, boltar@battlestar.co.uk wrote: > On Wed, 21 Oct 2026 07:55:39 -0000 (UTC) > Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> wrote: >> On Wed, 21 Oct 2026 07:42:30 -0000 (UTC), boltar wrote: >> >>> On Wed, 21 Oct 2026 01:29:18 -0000 (UTC), Lawrence D’Oliveiro wrote: >>>> >>>> On Tue, 20 Oct 2026 17:24:27 -0000 (UTC), boltar wrote: >>>> >>>>> ** The setting a flag method which has to be checked in every >>>>> nested loop test is just an [asinine] way to code. >>>> >>>> If you have to do cleanup at each level before exiting, then it >>>> works perfectly well. >>> >>> It may well work but it doesn't make it good. Its harder to follow - >>> whereas a goto out of a deeply nested loops is blindingly obvious - >>> and its less efficient. >> >> The goto from the deep inner block to the outer one is “blindingly >> obvious” ... ly wrong. > > Fine, well you stick with your gotos-are-bad religious doctrine based on > something one guy said 50 years ago and the rest of us will carry on writing > usable and easy to follow code. > >> What about the cleanup? > > What about it? you think a flag test in a loop automagically fixes that? I occasionally use GOTOs, but usually only after considering other alternatives. The flag test is the big red flag. If I have to keep testing a flag for several layers to get out of a loop, there has to be a better way.
Re: “The end of software secrecy is almost upon
Author: Radey Shouman
Date: Wed, 21 Oct 2026 14:41
Date: Wed, 21 Oct 2026 14:41
16 lines
1827 bytes
1827 bytes
ted@loft.tnolan.com (Ted Nolan <tednolan>) writes: > In article <11b9bn2$28tm$2@gal.iecc.com>, John Levine <johnl@taugh.com> wrote: >>According to William Hyde <wthyde1953@gmail.com>: >>>Ah, I do love zombie comments, where someone has changed the code but >>>left the comments as they were. >> >> i += 2; /* add 1 to i */ >> > > And then you find out it *does* add 1 to i. Somehow. Fixed point i with one fractional bit. Or something. --
Re: “The end of software secrecy is almost upon
Author: Scott Lurndal
Date: Wed, 21 Oct 2026 14:53
Date: Wed, 21 Oct 2026 14:53
17 lines
1645 bytes
1645 bytes
Radey Shouman <shouman@comcast.net> writes: >ted@loft.tnolan.com (Ted Nolan <tednolan>) writes: > >> In article <11b9bn2$28tm$2@gal.iecc.com>, John Levine <johnl@taugh.com> wrote: >>>According to William Hyde <wthyde1953@gmail.com>: >>>>Ah, I do love zombie comments, where someone has changed the code but >>>>left the comments as they were. >>> >>> i += 2; /* add 1 to i */ >>> >> >> And then you find out it *does* add 1 to i. Somehow. > >Fixed point i with one fractional bit. Or something. Or computing an index into an array of 16-bit entities in an array of bytes.
Re: Re: “The end of software secrecy is almost upon
Author: Scott Dorsey
Date: Wed, 21 Oct 2026 15:06
Date: Wed, 21 Oct 2026 15:06
16 lines
1569 bytes
1569 bytes
In article <11b9qna$pqb8$1@dont-email.me>, <boltar@battlestar.co.uk> wrote: >David Brown <david.brown@hesbynett.no> wrote: >>And people /do/ use concepts, even if you do not. > >Yeah, on university CS courses. They're just more metaprogramming fucking >about and add nothing of actual value for the jobbing programmer trying to >solve a problem. I kind of thought that way once. Then I worked with someone who decided to solve a problem that was NP-hard. I mentioned to him, "you know this is NP-hard, you'll never make it work for a reasonable number of elements" but he was convinced there was a solution. He worked on it for about a year before getting fired. --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis."
Re: “The end of software secrecy is almost upon
Author: Johann 'Myrkraverk' Oskarsson
Date: Wed, 21 Oct 2026 15:10
Date: Wed, 21 Oct 2026 15:10
22 lines
2321 bytes
2321 bytes
On 10/21/2026 11:06 PM, Scott Dorsey wrote: > In article <11b9qna$pqb8$1@dont-email.me>, <boltar@battlestar.co.uk> wrote: >> David Brown <david.brown@hesbynett.no> wrote: >>> And people /do/ use concepts, even if you do not. >> >> Yeah, on university CS courses. They're just more metaprogramming fucking >> about and add nothing of actual value for the jobbing programmer trying to >> solve a problem. > > I kind of thought that way once. Then I worked with someone who decided > to solve a problem that was NP-hard. I mentioned to him, "you know this is > NP-hard, you'll never make it work for a reasonable number of elements" > but he was convinced there was a solution. He worked on it for about a year > before getting fired. > --scott During that year, did he rewrite the code in Rust too? -- Johann | email: invalid -> com | http://www.myrkraverk.com/blog/ I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:; Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
Re: “The end of software secrecy is almost upon
Author: Dennis Boone
Date: Wed, 21 Oct 2026 15:57
Date: Wed, 21 Oct 2026 15:57
7 lines
1694 bytes
1694 bytes
> > i += 2; /* add 1 to i */ > And then you find out it *does* add 1 to i. Somehow. Very small values of 2. De
Re: “The end of software secrecy is almost upon
Author: David Brown
Date: Wed, 21 Oct 2026 15:57
Date: Wed, 21 Oct 2026 15:57
67 lines
4282 bytes
4282 bytes
On 21/10/2026 09:47, boltar@battlestar.co.uk wrote: > On Tue, 20 Oct 2026 20:50:58 +0200 > David Brown <david.brown@hesbynett.no> wrote: >> On 20/10/2026 19:24, boltar@battlestar.co.uk wrote: >>> If C/C++ had multi level break and continue keywords goto would almost >>> never be needed**. There's no reason they can't be added - along with >>> a lot >> of >>> other useful but basic fatures (eg non POD switch, native concatting >>> numbers >> to >>> std::string without calling to_string) - but I guess the committee >>> are too >> busy >>> circle jerking with esoteric crap no one will ever use (eg concepts) to >> bother. >>> >> >> Multi-level break and continue (named loops) is on its way to C++, and >> will almost certainly be accepted sooner or later (since it is already >> in the draft of the next C standard): > > They should have been added 30 years ago. > That's your opinion, so I won't argue with it. I haven't felt the need of them myself, but I appreciate that some people expect to find them useful. They are now in the draft C2y, and implemented in gcc. It is likely (though not guaranteed) that they will make it to C++ too. Wishing they had been added 30 years ago does nothing - adding your voice of support in the C++ standards mailing lists, or asking gcc to add it as an extension in C++ might be more useful. >> And people /do/ use concepts, even if you do not. > > Yeah, on university CS courses. They're just more metaprogramming fucking > about and add nothing of actual value for the jobbing programmer trying to > solve a problem. I use them in my code. I am not alone in that. You are using them too, if you are using a relatively modern C++ compiler - they are used in modern C++ standard library implementations. It's okay to consider them as "advanced", or something that "ordinary" programmers don't need - there's lots of stuff in C++ that most people don't need, but which exists so that it's easier to write efficient libraries that "ordinary" programmers /do/ use. > >> You might want to do some research before insulting the people who are >> actually doing the work in driving languages forward. > > Driving it forward into a ditch. The language is already so needlessly > complicated that students just swerve it for more user friendly ones, > mainly > Python. And Rust is already nudging C aside. If they ever add a decent > object model to it then C++ will be next in the firing line. > > If I was starting out today in IT I wouldn't touch C++ with the proverbial > barge pole. > Ok. Again, that's your opinion.
Re: Re: “The end of software secrecy is almost upon
Author: Scott Dorsey
Date: Wed, 21 Oct 2026 16:29
Date: Wed, 21 Oct 2026 16:29
24 lines
1872 bytes
1872 bytes
Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> wrote: >On 10/21/2026 11:06 PM, Scott Dorsey wrote: >> In article <11b9qna$pqb8$1@dont-email.me>, <boltar@battlestar.co.uk> wrote: >>> David Brown <david.brown@hesbynett.no> wrote: >>>> And people /do/ use concepts, even if you do not. >>> >>> Yeah, on university CS courses. They're just more metaprogramming fucking >>> about and add nothing of actual value for the jobbing programmer trying to >>> solve a problem. >> >> I kind of thought that way once. Then I worked with someone who decided >> to solve a problem that was NP-hard. I mentioned to him, "you know this is >> NP-hard, you'll never make it work for a reasonable number of elements" >> but he was convinced there was a solution. He worked on it for about a year >> before getting fired. > >During that year, did he rewrite the code in Rust too? If he'd have thought of that he probably could have milked another year out! --scott -- "C'est un Nagra. C'est suisse, et tres, tres precis."
Page 2 of 11 • 529 total messages
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads