One related issue maybe using multiple return statements in a function. I sometimes do that (especially from nestedc ifs), but some will say it's not entirely kosher (and of course it is to some degree risky).

tl;dr: pibbuR has a joke about this, in the PS section down below.

PS. The joke:
A programmer and his family for some reason spent some time in the US. His little daughter was playing outside with a neighbour boy. They started a quarrel, and the neighbour, not very diplomatically, suggested she ought to visit hell. In tears she ran home. "Mommy, he said the bad word. He said goto."
DS
 

One related issue maybe using multiple return statements in a function. I sometimes do that (especially from nestedc ifs), but some will say it's not entirely kosher (and of course it is to some degree risky).

tl;dr: pibbuR has a joke about this, in the PS section down below.

PS. The joke:
A programmer and his family for some reason spent some time in the US. His little daughter was playing outside with a neighbour boy. They started a quarrel, and the neighbour, not very diplomatically, suggested she ought to visit hell. In tears she ran home. "Mommy, he said the bad word. He said goto."
DS
He doesn't give examples, so it's hard to say why he posted this or what he's talking about. I assume it's constructs like break, continue, throwing an exception, and (as you said), returning before the end? He seems pretty upset. :D
 
I use GOTO from time to time. It's pretty rare, but sometimes it's just a lot more readable that way. One that jumps to mind is having some complicated business logic, where there's one special case that takes a lot of checking to dig into means you should do something that's way up in your logic checks. Like:

If Cheap Logic then
Do Easy Stuff
Else
If Expensive Logic Then
Do hard stuff
Else
Do Easy Stuff

You could make a function call for Easy Stuff and definitely should if it's a lot of lines of code. If it's just a couple of lines, though, I'll do a GOTO and be sure to give it a nice label.

And then I'll put a comment in saying I just used a goto and I did it on purpose. The cops haven't shown up yet.
 
Sure C has a goto; and of course even fortran has a goto. I used a goto in C once for an interpreter - it was an exception case around a longjump when the entire interpreter had to reset it self.
I know, but I mean in modern languages, it has all but disappeared. The only related concepts are break, continue, and exceptions.
 
Finally they come to their senses:

Rust, the C-way ("Crust"?) - pibbuR likes that.
It seems to work, in its awkward way. It's good for interfacing with C/C++.

Code:
const CSTRING: &CStr = c"Hello, world!";
let rst = CSTRING.to_str().expect("conversion failed");
println!("'{}'", rstr);

let rstring = "Hi, world!\x00";
let bytes = rstring.as_bytes();
let cstr = CStr::from_bytes_until_nul(&bytes).expect("conversion failed");
println!("{:?}", cstr);
(Hmm, there's no Rust code highlight ;))

Strings in Rust are a bit of a pain, or maybe not, depending on what you need. They are built with UTF in mind, which means each character has its own size (1-4 bytes for UTF-8). Accessing the nth character of a string is made with the cumbersome str.chars().nth(n).unwrap(), so by converting the string into an iterable, counting until the nth character, and checking that it exists. You can't have a direct access with an offset like str[n], unless you're sure it's only ascii, and even then, you must enclose the code in 'unsafe' tags and so on.

I often wish there was a simple fixed-size character string type for ascii text. It's sort of possible, but not as comfortable as the default String type.
 
In this thread about a DOS game in a virtual VirtualBox DOS machine, there is an orgasm hidden there : https://forums.virtualbox.org/viewtopic.php?t=105286

( I have found a very old "OS/2 Warp 3 Try & Buy" demo CD, and now I want to try this out in VirtualBoxm but my DOS machine refuses to reboot ... I feel so stupid because of not being able to solve this tiny problem ... )
( Edit : I found the solution : In VirtualBox one has to use the special host key for that virual mache + DEL to make a DOS-machine to reboot. )
 
Last edited:
I very reluctantly (of course) post this:

"The reason is that the majority of security vulnerabilities in large codebases can be traced to memory security bugs. And since Rust code can largely if not totally avoid such problems when properly implemented, memory safety now looks a lot like a national security issue."

I do have a minor issue with the above. I would say that properly programmed C/C++ code should also avoid memory problems. But I admit that it's easier to avoid them using Rust.

pibbuR who will learn Rust when the time comes (whenever that is).
 
I need to explore machine learning. Or rather, I want to. But there's one problem: It's (nearly) all about Python. I don't like Python. I think it's a good language and there's a ton of useful libraries for it. I would also without doubt recommend anyone wanting to learn programming to go for it. And I've learned it. But I don't like it. C++ is much more funny, and since I do all my programming for fun, C++ is my language of choice, simple as that.

PyTorch is one of the libraries used for machine learning. There is a C++ front end for it (https://pytorch.org/cppdocs/). Maybe there are also C++ APIs for other useful Python libraries? Any watcher having experience with this?

pibbuR+-
 
I need to explore machine learning. Or rather, I want to. But there's one problem: It's (nearly) all about Python. I don't like Python. I think it's a good language and there's a ton of useful libraries for it. I would also without doubt recommend anyone wanting to learn programming to go for it. And I've learned it. But I don't like it. C++ is much more funny, and since I do all my programming for fun, C++ is my language of choice, simple as that.
Out of curiosity, what don't you like in the Python language?
 
Out of curiosity, what don't you like in the Python language?
I'm not @pibbuR but i was forced to use Python for some scripting purposes and i had two hates for the language:
1) a single space can change the behavior of a program - i do not think white-space of that nature should change the behavior of a program.
2) This is less relevant today; but i had to review some code once in the early days and require dwelling into the core implementation of python thread model only to discover it was fundamentally broken in many ways. Correctness require correctly implemented libraries but the implementers made the fundamental error of presuming true multi-processor systems did not exist (our company exclusively used server mb with 2 processors); naturally when dual-core processor was introduce around 2006 the implementers reconsider their position and the thread libraries were re-written. Of course we could look at linux implementation of threads in 99/00 and make similar statements - but at least they were fundamentally correct if too expensive to use. I guess around 2004 or 2006 true kernel threads were widely available and worked efficiently.

Oh well probably @pibbuR will have a different answer but maybe not.
 
It's very convenient that it can be used with an interpreter and it's very flexible, but the main reproach I have is the lack of static typing. Because of that, I don't think it's fit for large or safety-sensitive projects.

I'm using it a lot to test things or when I quickly need to process data and performances aren't an issue.
 
More about the xz backdoor (https://www.osnews.com/story/139064...-xz-liblzma-leading-to-ssh-server-compromise/) and what to learn from it:


"This is a story of the sole maintainer of a crucial building block of the open source stack having mental health issues, which at least partly contributes to a lack of interest in maintaining xz."

"What seems to have happened here is a bad actor – again, most likely a state actor – finding and targeting a vulnerable maintainer, who, through clever social engineering on both a personal level as well as the project level, gained control over a crucial but unexciting building block of the open source stack. Once enough control and trust was gained, the bad actor added a backdoor to do… Well, something. It seems nobody really knows yet what the ultimate goal was, but we can all make some educated guesses and none of them are any good."


More on mental health:

pibbuR who from experience knows a bit or to about mental unhealth
 
Last edited:
It's very convenient that it can be used with an interpreter and it's very flexible, but the main reproach I have is the lack of static typing. Because of that, I don't think it's fit for large or safety-sensitive projects.

I'm using it a lot to test things or when I quickly need to process data and performances aren't an issue.
For our usage (system utility); strong types wasn't an issue. While the language has gain a lot of attention over the years due to ease of use; i think for its original designed application the typing is a non-issue. If you want strong types and an interpreter there is always Java; of course for system programming Java sucks rotten egg so there is that aspect.

I think for me i'll stick with C++; to be honest i can write C++ programs faster than python and they use less cpu cycles which can be a big deal with the sort of data load i tend to deal with; after all i'm not sure i want to process 10 of million of requests per minute with python.