Cmd-- 1.11

Pages: 123456
closed account (S6k9GNh0)
@ helios, That seems more like a hack.

@ ne555, I would still say it depends on environment. For a webserver, restarting the server to cut off idle connections is easily ideal compared to chrisname's solution. In a type of server meant for long-term connections where the client user might go away and expect to still be connected, then I might agree.
Last edited on
> I would still say it depends on environment
in an environment were a good approach is simply to wait, ¿how would you do it?
iirc yield would put the process as idle not blocking ¿is there a way to block the process, maybe touching setting of the OS?

(in the case of a new request)
Last edited on
computerquip: And your point is...?
closed account (S6k9GNh0)
"In modern computing terminology, a kludge (or often a "hack") is a solution to a problem, doing a task, or fixing a system that is inefficient, inelegant, or even unfathomable, but which nevertheless (more or less) works."

Kinda sounds complicated with little gain...?
How is "an exception is thrown" complicated? If anything, I'd say it's a rather elegant solution to the problem. You have a stack of the form foo() -> [external code] -> bar(), where bar() never returns, and you want to ensure that resources allocated by the external code are released. Is there a simpler solution than exceptions?

The cleanup of resources isn't what I'd call "little gain". Some resources, such as automatic locks on mutexes, must absolutely, positively be released, and if some functions aren't guaranteed to ever return, guaranteeing that becomes rather complicated.
I agree with computerquip that it's a hack. It's not a good way to do it, but it works.
I'm not arguing whether it's a hack. It's obviously one, as it uses a feature in a way it's not intended. I'm asking how that fact is opposed to what I said, that exceptions can be extremely useful to redirect control flow.
It seems like a good solution to me. It may be hackish and unusual but it's not like it's exploiting undefined behaviour (which would be unsafe and unportable) and it sounds like other ways of achieving the same thing would be more complicated, and possibly thereby less safe, less portable, or less maintainable. It makes sense to use the exception mechanism there. But, like helios said, it's only in very specific circumstances -- in the general case, exceptions are for indicating specific error conditions.
1.02 is up. Lots of changes, improvements, etc.

@ne555, just saw your last post about the core menu flow (again with the posts popping up out of order). I'll need some time to think about that. Its 12:40 am, here, I should really get to bed ;)
okay, ne555 your suggestion about the string hierarchy has now been implemented. Related menus now only require the parent string id to be given to the child; the parent scans the menu list to find a child menu with its string id in order to execute the right menu.

Not quite ready to release it just yet though, I want another day or so to double check everything and add a few features. Does anyone know of a non-OS dependant way of setting command line colour? I have heard that system() calls are not the best idea, but I don't want to use the Windows API for this (and break portability in the process)
Actually, about that. Do you have a link to a PDCurses library that's still under development? I was under the impression that the original PDCurses library stopped being developed in 2008.

The last CVS commit is from last year. But to more directly answer your question, no I don't.
closed account (S6k9GNh0)
ncurses has worked with mingw for years. The idea that pdcurses or pcurses pertains to Windows and ncurses pertains to *nix hasn't really had much validity.
No one said anything to that effect, though.
closed account (S6k9GNh0)
uh, ncurses is an implementation of curses yet only pdcurses is brought up when it comes to Windows. It's clearly implied.
I brought PDcurses up because ncurses is GNU. I'm not implying anything about their technical capabilities. If anything, I assumed ncurses works on Windows as well.
Even if you dislike GNU software, why would you bring up an inactive project instead of an active one?

Also, the curses API is horrible anyway. I don't know what else there is that's cross-platform though.
Honestly, I wasn't aware that it was inactive. Even if I had been, it'd take more than merely being inactive to get me to recommend a GPL project over a public domain one. Like dispensing live wasps or something. :-)
...what are you talking about, helios?

Beginning with release 4.2, ncurses is distributed under an MIT-style

This was quoted from the README from the latest release of ncurses. I checked the license myself, and it is indeed MIT (except with a BSD-esque no-using-names-in-advertisting clause).

Last edited on
Pages: 123456