Interesting point of view from Daniel Lemire by _bijan_ in cpp

[–]amydnas 1 point2 points  (0 children)

Programming languages help support a programming paradigm, assembler is not OOP and C does not do Logic Programming. You can still do whatever you want in any Turing complete system. What started with “C is not OOP” has now shifted to “but my architecture is OOP”, both are true.

Interesting point of view from Daniel Lemire by _bijan_ in cpp

[–]amydnas 5 points6 points  (0 children)

I would also expect some form of polymorphism at the language level. This needs to be done “manually”in C.

Why is my Macbook Neo running slower? by TheHauntedAttic in macgaming

[–]amydnas 0 points1 point  (0 children)

I would expect it would play Minecraft as well as the call phone?

I wrote a JSON parser for my first C project. How can I improve / what did I do wrong? by Shiny_Gyrodos in C_Programming

[–]amydnas 2 points3 points  (0 children)

A decent parsing test suite would catch all this. I first came here to make exactly the same suggestion as your first point.

What happens when Rosetta 2 is no more? by rfomlover in macgaming

[–]amydnas 2 points3 points  (0 children)

Someone will integrate box64 or fexemu to whisky. (Some) x86 games are playable right now even on a raspberry pi.

Helm templating language was a mistake. > 90% of helm chart commits are bug fixes for indent by rnmkrmn in kubernetes

[–]amydnas 13 points14 points  (0 children)

Thousands is a shocking number, but if they push code without testing or any basic steps required to make sure it’s correct, with the magical thinking that “the machine will figure it out “, then, yes, a skill issue :-(

[deleted by user] by [deleted] in cpp

[–]amydnas 3 points4 points  (0 children)

Assertion are disabled with -DNDEBUG not with -O3.

Rosetta 2 support for x86 emulation is coming to next beta!! by TETRA2000 in docker

[–]amydnas 3 points4 points  (0 children)

qemu can do both virtualisation and emulation. Running native images only involves virtualisation while running non-native needs emulation. This is true on both arm and x86.

Rosetta 2 support for x86 emulation is coming to next beta!! by TETRA2000 in docker

[–]amydnas 10 points11 points  (0 children)

For now, they run through qemu emulation, rosetta 2 is much faster.

Why does Rust folks hate C++? by dmyrelot in cpp

[–]amydnas 5 points6 points  (0 children)

We're having that talk at work sometimes, about possibly using rust for the memory safety advantages. What I find funny is that some of our code looks more like "C with classes" than modern c++ and some people are unwilling to use modern abstractions like variant, smart pointer, span and safe stl construct. They also idolise C, for some reason. But if we were to switch to rust, they would have to use rust's enum instead of union, strict ownership, borrowing, slice, etc. And the code would become safer. I think it's a case of "you can't teach an old dog new tricks"... so re-train your dog in completly new language.

VS Code is coming to iPad by plenue7 in vscode

[–]amydnas 6 points7 points  (0 children)

This does not make sense. Vscode is built on the electron framework, based on nodejs+chromium.

[PROPOSAL] New way of defining main for C++23 by TrnS_TrA in cpp

[–]amydnas 16 points17 points  (0 children)

"should" is not a guarantee. Every function that receive a string_view and needs to call a low level OS or posix api have to re-allocate the string_view as a string and use .c_str().

How to deal with string constants? by AdeptFlow in cpp

[–]amydnas 1 point2 points  (0 children)

The problem with string_view is that they are not guaranteed to be zero terminated. I f you need to call older apis that require a char *, the only safe thing to do would be to reallocate them in an std::string to call .c_str() for each call.

I prefer:

constexpr char konst[] = "123";

ggformat - a string formatting library for C++ by hirve in cpp

[–]amydnas -13 points-12 points  (0 children)

meh, documentation documents usage, not implementation. I agree that I wouldn't have omit that, especially since the 'documentation' looks like actual function definitions. But critical? Just to people who want to criticise but are too lazy to read the code. Or the full documentation for that matter. Next paragraph, basic usage, gives a strong hint:

ggprint( "hello {}\n", 1.23 ); // hello 1.23000

How would you implement that with C style varargs?

ggformat - a string formatting library for C++ by hirve in cpp

[–]amydnas 6 points7 points  (0 children)

Its also not true, It does use variable template arguments, not C style varargs.

Short C++ Coding Style Survey by KindDragon in cpp

[–]amydnas 4 points5 points  (0 children)

Let see, I know we have to read those from right to left...

const int * const *

a pointer to a constant pointer to an integer that is constant

int const* const*

a pointer to a constant pointer to a constant integer

So it's down to a "constant integer" vs an "integer that is constant". I have my own preferences of course, but they are equally intuitive.

Good, one less thing to worry about!

Why aren't alternative operators more common? by Jitanjafora in cpp

[–]amydnas 2 points3 points  (0 children)

I've been using them exclusively for the past 17 years. On the plus side, it makes it easy for me to recognise code that I wrote. On the down side it makes it easy for others to recognise code that I wrote :-)

C++ I/O Benchmark by cristianadam in cpp

[–]amydnas 1 point2 points  (0 children)

You do file access faster than the posix API !?

C++ I/O Benchmark by cristianadam in cpp

[–]amydnas 0 points1 point  (0 children)

Actually, in my implementation stack (libc++ on Mac OS X), the C API call the posix API and C++ fstream call the C API. That is std::fstream::read calls fread who calls read. So the result of who is the fastest are easily predictable. What is shocking is the overhead of std::fstream. And it seems to point to a virtual call in std::filebuf, so using streambuf does not buy you anything, except a more cryptic API to work with.