New language Carbon

So, I’ve been doing C# since 2005, so it is hardly “new”. It is gaining because it is actually pretty good, and the developers are investing in making the language richer. But the framework has really not changed all that much since generics (.Net framework 2).

I also do other stuff. I know quite a few other languages, and honestly, once you know the basics of one, generally it isn’t hard to move to another. I picked up Python and Lua in a few days for example.

I’m not fan of Rust because it looks ugly and is too opinionated, but that is my preference. I also think a lot of the newish languages (Odin, Zig etc) are ugly. Also my opinion.

I think there are bedrock languages out there (C/C++) and business languages out there (Java/C# and probably Python) and there are Web languages out there (Javascript/Typescript etc) and they all have their merits in their spheres. But C# is a bloody good general (non systems) language and miles better supported than a lot of the newbie languages. I would suggest that if you know any C++ or Java you could pick it up pretty easily and the jobs are ubiquitous. I literally get recruiters messaging me every day.

I have the same problem with huge runtimes as I have with bloated operating systems. They have poor cache performance due to the ratio of the code size to the cache size. There is a slight improvement in cache latancy due to the code being reusable but not enough to justify the effort.

It also sets the alignment requirement for the struct. So structures defined this way could have, for example, an odd address in RAM and code generated to access them will be pessimised accordingly.

In this example there isn’t any padding on naturally aligned platforms so pack(1) is only giving the effect of ruining the alignment promise of the structure. Most of the time if I see anything like this, it means the people who wrote it have no idea what they’re doing.

1 Like

we deal with this in automotive industry, do you have this answer rote memorized, instead of, i would research the fundamentals and take a data and science driven approach.

I’m more interested in someone’s problem solving skills, than there ability to regurgitation of facts

For your first statement - that is what I said. It aligns the bytes in memory. A struct is just a block of bytes, the fact you see an integer or char array is just a representation of those bytes. The computer sees bytes.

That is a bit harsh and quite misguided. If you have a binary protocol over a radio carrier, packing the bytes to 1 saves you a massive amount of air time. If you do something with short messaging services with limited payloads, you also embrace packing to 1 byte. It also compresses data in memory - so it is beneficial to at least set 2 byte alignment when you are dealing with limited memory.

No, and that’s unfortunate. The example structure you wrote is already naturally aligned on real platforms and so doesn’t have any padding. It’s eight bytes. But with your pragma the compiler is told not only that it shouldn’t add padding (it wasn’t anyway) but that the entire structure gets single byte alignment. As a result on CPUs where unaligned access is trickier you emit code to perform that access even if you never needed it.

This doesn’t help you at all in terms of air time, but it costs you performance / battery life on some hardware (e.g. older ARM CPU cores). And you won’t “compress” things that were anyway naturally aligned. What you’d want there is stuff like niche optimization which you can’t have in C++ because the underlying type assumptions are incompatible.

1 Like

The example was an example. Real world structs are not nice simple examples like above and on Windows, natural alignment is extremely costly. Most of our stuff, the on air is king. I get what you are saying, but real world ota protocol tells me you are only half right. Unfortunately, you need to marshal the data somehow and copying data between structures for transport is costly.

That sounds like a whole load of FUD. I also would say “silence is golden and talking is silver”. I don’t think you really added anything useful there.

I have the same opinion about huge frameworks like SamuraiCrow. So I feel targeted indirecty by your critics, too. And I feel a bit personally insulted, though I guess it wasn’t meant as a personal insult at all. But all the shiny modern frameworks are bloat; and I don’t see why saying this is irrelevant.

Greetings
Peter

1 Like

the frameworks are vendor lock in appliances, never forget that

1 Like