What C++ Compiler Do You Use and What OS Do You Compile To? - /g/ (#105968706) [Archived: 146 hours ago]

Anonymous
7/20/2025, 6:31:57 PM No.105968706
compiler
compiler
md5: 8381c11092fad23f7cbd57df3c469185🔍
Replies: >>105968713 >>105968757 >>105969079 >>105969080 >>105969674 >>105972369 >>105972913 >>105975622 >>105975637 >>105978121 >>105978646 >>105980295 >>105983643
Anonymous
7/20/2025, 6:33:05 PM No.105968713
>>105968706 (OP)
GCC and bare metal.
Replies: >>105968728 >>105969061
Anonymous
7/20/2025, 6:33:16 PM No.105968716
I don't give a fuck and he's literally Mossad and has no MIT affiliation whatsoever.
Replies: >>105981805
Anonymous
7/20/2025, 6:34:37 PM No.105968728
>>105968713
What do you make
Anonymous
7/20/2025, 6:35:25 PM No.105968733
Does Arduino count?
Anonymous
7/20/2025, 6:36:02 PM No.105968739
i compile to ur mom, she activate all my flags
Anonymous
7/20/2025, 6:38:01 PM No.105968757
>>105968706 (OP)
Clang, my own fork that implements my own version of c++
Windows
Replies: >>105968856
Anonymous
7/20/2025, 6:49:56 PM No.105968856
>>105968757
Why do you need your own fork? What's different about your fork that it didn't have originally?
Replies: >>105969079 >>105972869
Anonymous
7/20/2025, 7:14:34 PM No.105969061
>>105968713
arm-none-eabi-gcc ftw
Anonymous
7/20/2025, 7:17:26 PM No.105969079
>>105968706 (OP)
Clang (my own fork that compiles to my own version of C++)
Linux

>>105968856
Because Bjarne is a retard incapable of designing an elegant language.
Replies: >>105969651
Anonymous
7/20/2025, 7:17:28 PM No.105969080
cc
cc
md5: 82dcf688f548bf620f7f464885a1e978🔍
>>105968706 (OP)
Anonymous
7/20/2025, 8:21:42 PM No.105969651
>>105969079
Yeah but what did you change
Replies: >>105972874
Anonymous
7/20/2025, 8:23:40 PM No.105969674
>>105968706 (OP)
I wish Lex would just stop making these shit videos and apologize for all of his lies.
Anonymous
7/20/2025, 9:05:46 PM No.105970113
jude
Anonymous
7/20/2025, 11:47:28 PM No.105971736
sauce?
Anonymous
7/21/2025, 12:48:58 AM No.105972335
I just started learning C++ this week. I use g++ on Linux
Replies: >>105972849
Anonymous
7/21/2025, 12:52:47 AM No.105972369
>>105968706 (OP)
I can't stand this boring cunt. I bet he talked about love
Anonymous
7/21/2025, 1:46:15 AM No.105972849
>>105972335
this is a schism post.
I hate gcc/clang on linux because address sanitizer has leak sanitizer built in and ANY gui library is going to have false positives (mainly nvidia drivers / fonts), it would be fine if I could build with a flag to disable it, but you can't, and the suppression file still shows report (suppressed), and skipping dlclose can hide useful leak in libraries. So I set a environment variable in my IDE to disable it.
With msvc, it won't check for leaks. Leaks are not a big worry on C++, and asan does not detect uninitialized memory errors, while valgrind / dr memory can (but valgrind/dr memory can't detect a lot of other errors Asan checks such as off by 1 stack corruption).
Also I love msvc iterator debugger, it has stopped be from being a retard. With gcc/clang you can use _GLIBCXX_DEBUG.
If you want more paranoia regarding numeric under / overflow casting, I suggest using clang with undefined behavior sanitizer with:
-fsanitize=unsigned-integer-overflow -fsanitize=implicit-conversion
and these are also not enabled by fsanitize=unsigned on clang:
-fsanitize=nullability -fsanitize=local-bounds
GCC has ubsan, I think it doesn't check for signed overflow because it has ftrapv instead (ftrapv does not work for narrowing conversions, it does work if you do +1 after INT_MAX), but gcc doesn't have anything to check for unsigned overflow.
If you had a intentional overflow, you would cast it (static_cast or C cast). This is very bad to combine with a narrowing warning (like -Wconversion unless you manually disable it for each case, not possible, I use clang-tidy because //NOLINT is easier) because otherwise the only way to remove the warnings is if you cast it, which ignores ftrapv and ubsan's overflow detection (if it's unintentional to over/underflow).
Replies: >>105973737 >>105979062
Anonymous
7/21/2025, 1:47:55 AM No.105972869
>>105968856
I am adding any feature I can think of.
A few notable features.
1. Allow class methods to be defined without being forward declared in the class body. This solves the issue of private leaking into the public interface.

2. Heterogeneous initializers for arrays
This feature takes whatever arguments you pass it and flatten them into bytes. Its purpose is to generate data tables with multiple struct types.

[[heterogeneous_bytes]]
unsigned char arr[] = {
<expressions of any type>
};

3. named array elements.
A complimentary feature to heterogeneous initializers, that allows giving specific elements a name. This can later be used with __builtin_offsetof, to get the byte offset of a named element. You can use this to generate complex tables that use offsets to reference other parts of the table.
Labels start with a colon, the reason being this is just what syntax was unused.

unsigned char arr[] = {
:<label name> <initializer expression>
};
Replies: >>105973045
Anonymous
7/21/2025, 1:48:53 AM No.105972874
>>105969651
nta but i did the same, i added syntactic sugar and re-designed the standard library to feel more like rust, but kept c++ style declarations
Anonymous
7/21/2025, 1:53:04 AM No.105972913
>>105968706 (OP)
Digital Mars C on XP.
Anonymous
7/21/2025, 2:10:29 AM No.105973045
>>105972869
Here are a few I would have thought of:
1. Adding Java-style array declarations:
int[] a;
// instead of int a[]
// note that things like std::make_unique<int[]>(10) are already valid

2. Rust-style using statements:
using a::b; // equivalent to namespace b = a::b;
using std::*; // equivalent to using namespace std;
using std::a::{b::B, c::{C, D}, e::*, f::{self, F, G}}; // more complicated example

3. Java-style annotations syntax instead of the new upcoming reflection annotation syntax
using clap::{Help, Long, Short};

struct Args {
@Help("Name of the person to greet")
@Short
@Long
String name;

@Help("Number of times to greet")
@Short
@Long
int count = 1;
};

// original code:
struct Args {
[[=clap::Help("Name of the person to greet")]]
[[=clap::Short, =clap::Long]]
std::string name;

[[=clap::Help("Number of times to greet")]]
[[=clap::Short, =clap::Long]]
int count = 1;
};

4. Interfaces like C# and Java and an abstract keyword (because using pure virtual functions to declare abstract classes kind of sucks)
abstract class W { ... };
class X { ... };
class Y { ... };
interface IA { ... };
interface IB { ... };
class Z extends W, virtual X, virtual Y implements IA, IB { ... };

Anyway, nothing revolutionary, but still interesting to think about.
Replies: >>105973550 >>105979137
Anonymous
7/21/2025, 3:36:19 AM No.105973550
>>105973045
These would be grear, actually. C++ has some notoriously ugly syntax compared to Java.
Anonymous
7/21/2025, 4:08:41 AM No.105973737
>>105972849
>all this nonsense instead of using rust
Do cniles really
Replies: >>105974637 >>105975007 >>105975189 >>105979062
Anonymous
7/21/2025, 6:55:13 AM No.105974637
>>105973737
sunken cost
Anonymous
7/21/2025, 8:09:47 AM No.105975007
>>105973737
I don't think I have seen anyone actually programming like that, that's just me.
I think a normal person just turns on the sanitizer and they don't care about warnings, or they just turn on Wconversion and just patch all the warnings with casting.
Anonymous
7/21/2025, 8:35:00 AM No.105975189
1716911964607133
1716911964607133
md5: 37ecaebccb7f64f83f491919ca7d39d7🔍
>>105973737
nobody uses rust
Replies: >>105977346
Anonymous
7/21/2025, 9:50:20 AM No.105975622
>>105968706 (OP)
linux: clang for development, gcc for release
mac: appleclang
windows: msvc
Anonymous
7/21/2025, 9:52:11 AM No.105975637
>>105968706 (OP)
lex talks about dvorak, split keyboards, neovim and all that nerd shit. all markers for someone who can't code
Anonymous
7/21/2025, 10:41:36 AM No.105975860
I saw Lex Fridman at Drexel once. I told him how cool it was to meet him in person, but I didn’t want to be a douche and bother him or ask for photos or anything.

He said, “Oh, like you’re doing now?” and gave me this long, expressionless stare.

I was taken aback, and all I could say was “Huh?” but he kept cutting me off and going, “Huh? Huh? Huh?” while slowly typing on one of those split keyboards that wasn’t plugged in.

I said, “I really liked your interview with Elon,” and he said, “He liked it too. He told me telepathically.”

Then he pulled out an MIT lanyard from his backpack (no ID, just an empty lanyard) and stared at it for like thirty seconds. Finally he whispered, “Can we steelman the case for credentials being a social construct?”

I didn’t know what to say, so I just nodded.

When I was leaving later, I saw him trying to walk out of the engineering building with like five Raspberry Pis and a bag of ethernet cables without signing them out.

The lab tech was super chill and professional, and was like, “Sir, you need to check those out first.” At first he acted like he didn’t hear her and just stared at the floor, but eventually he turned back and placed them on the desk one by one.

When she picked up one of the cables and started scanning it multiple times, he stopped her and told her to scan them each individually “to prevent any malignment” Then he turned around and winked at me.

I don’t even think that’s a real word.

After she logged everything and handed him the checkout form, he interrupted her by yawning really loudly. Like over and over. Just loud, deliberate yawns.

I watched him carry it all outside until he got into the back of a Tesla and it drove off.
Anonymous
7/21/2025, 3:02:12 PM No.105977346
>>105975189
c is for subhumans and rust is aryan
Replies: >>105977984
Anonymous
7/21/2025, 3:16:46 PM No.105977432
Clang to WebAssembly because I hate my life.
Anonymous
7/21/2025, 3:20:18 PM No.105977456
1660651139354569
1660651139354569
md5: 5117773ffd5c51f6172fe25b7fcc344b🔍
anything else than clang is trolling yourself. first because of clangd. second because GCC is just trash and can't into errors
Replies: >>105977872
Anonymous
7/21/2025, 4:14:20 PM No.105977872
>>105977456
clang is good because it is natively c++
captcha: TNDWH2
Anonymous
7/21/2025, 4:28:25 PM No.105977984
rust
rust
md5: f6232142d0cd5285e3c5ed901e3ec6e8🔍
>>105977346
nice larp. rust is for trannies like (you)
Replies: >>105978596
Anonymous
7/21/2025, 4:48:10 PM No.105978121
>>105968706 (OP)
I would like to use clang but life forces me to use msvc.
Anonymous
7/21/2025, 5:44:12 PM No.105978596
>>105977984
>saaaaar please let me insert my gay lisp code so i can show you how much of a tinkertranny i am
kys fag
go back to your cs101 class and stay there
Anonymous
7/21/2025, 5:49:14 PM No.105978646
>>105968706 (OP)
>What C++ Compiler Do You Use
gcc
>What OS Do You Compile To?
Uhm, ackshually, don't you mean object file format and architecture?
Anonymous
7/21/2025, 6:32:58 PM No.105979062
>>105972849
you should try -Wconversion. I compiled an old project of mine with it and it gives really good insights (both clang and g++). Nevertheless, you're right that clang generally has better diagnostics and tooling. It's also more tightly integrated with IDEs (clangd, ccls, clang-tidy, clang-format etc..). That said, I still prefer building with gcc for release mode, there are just some edge cases where it'll perform slightly better than clang. And it also supports much more stuff out of the box, like cross compilation.

For integers behavior, gcc (and clang) let you customize the behavior with these options:
https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Signed-Overflow.html
On most systems, INT_MAX+1 == INT_MIN, but that's not always the case, which is why gcc lets you force this behavior for systems where that's not the default.

>>105973737
Bro I'd like to use it, in fact I use it for personal projects, but it's just not there in the entreprise world. Only offer I've got was for a crypto company (web backend) that went under after 6 months. Feels like an insult using rust for web backend.
Replies: >>105979204
Anonymous
7/21/2025, 6:40:12 PM No.105979137
>>105973045
My honest opinion is that they should drop the current syntax. There are many issues with is, such as this being the recommended default for accessors:
class Whetever
{
[[nodiscard]] constexpr const decltype(auto) GetX() nothrow const { return this->value; }
};

The amount of boilerplate is insane. That said, the language is awesome, the features that C++ has (especially talking about constexpr and templates) are things that are unlikely to be seen in any other compiled language ever.

I think they really should come up with a new syntax. Herb sutter's experiment looked really promising.
The standard should state that every file under the extension "cpp2" or "hpp2" must be using the new syntax.
Replies: >>105979220 >>105979613 >>105979640
Anonymous
7/21/2025, 6:44:59 PM No.105979204
>>105979062
c23 added macros that tell you if you had overflow.
you can write the functions yourself if you don't use c23.
add(&sum, lhs, rhs)
{
if (INT_MAX - rhs > lhs) ( handle overflow )

you fill in the rest, youre smart
}
Replies: >>105979409 >>105980312
Anonymous
7/21/2025, 6:46:10 PM No.105979220
1638392562257
1638392562257
md5: 09bae68569d6f4842e8bda4c6e66dd31🔍
>>105979137
mmhmm but when i post this shit all the sepples yell at me that it's contrived
Replies: >>105979409 >>105979575
Anonymous
7/21/2025, 7:02:07 PM No.105979409
>>105979204
overflows and underflows usually happen in places where you don't expect them. Like your coworker running a 'i-1' on an array, while forgetting to handle the case where i = 0, leading to segfaults.

>>105979220
the code I posted is what the official c++ guidelines recommend. Your code should not take a reference for arithmetic values as those are often small (half a word for int, single word for long on x64).
You should do something like this instead:
template <typename T>
requires std::is_arithmetic_v<T>
[[nodiscard]] static constexpr auto add(T&& a, T&& b) noexcept -> T
{
// Arithmetic types are trivially copyable on most architectures, but forward just in cast
return std::forward<T>(a) + std::forward<T>(b);
}
Anonymous
7/21/2025, 7:16:39 PM No.105979575
>>105979220
>implying the C version isnt valid in C++ and not what most people in C++ would just write anyway
nice try cniletranny
Anonymous
7/21/2025, 7:19:38 PM No.105979613
>>105979137
Never liked cpp2. The syntax is quite horrid.
I just want Java-style declarative syntax that is easy to read and understand and any Rust or C# style syntactic sugar that might be worth adding.
If C++ abolished C-style syntax, it would become another irrelevant memelang.
>hpp2
A redesigned C++ should have no headers at all, only modules.
Replies: >>105980166
Anonymous
7/21/2025, 7:22:04 PM No.105979640
>>105979137
>constexpr const
wtf, why?
constexpr is already const, so whats the point
am i missing something
Replies: >>105980119 >>105980166
Anonymous
7/21/2025, 7:23:27 PM No.105979652
checking for overflow by doing the arithmetic op is a rookie mistake. Compilers will always """optimize""" it as if it could not happen because they decided UB means fuck you that's why.
And doing any sort of limit comparisons is fucking retarded, especially for multiplication.
GCC and clang have __builtin_add_overflow which gives you boolean. It compiles to carry flag on most architectures, which is how you should check for overflow in assembly anyway.
Actually not sure what it does on risc-v since they don't have carry
Replies: >>105980186
Anonymous
7/21/2025, 8:11:57 PM No.105980119
>>105979640
yo bro i heard you like const dot jpeg
Anonymous
7/21/2025, 8:18:33 PM No.105980166
>>105979640
'constexpr' means the function can be run at compile time, it has nothing to do with the return value, which is what the 'const' is for.
I messed up my post but the return value should have been inside parenthesis, so that 'decltype(auto)' would make the function return an lvalue (as opposed to simply auto which would return an rvalue).

>>105979613
headers would likely still be needed, they're required when you want to distribute a proprietary shared object/dll while still allowing people to make code that links to it.
Replies: >>105980494
Anonymous
7/21/2025, 8:20:57 PM No.105980186
>>105979652
this, some anon the other day posted this retarded code:
int inc_will_overflow(int x)
{
if (x + 1 < x) return (1);
return (0);
}

Now, gcc and clang CAN make overflow a defined behavior with -ftrapv and -fwrapv but that's not in the standard.
Replies: >>105980312 >>105981676
Anonymous
7/21/2025, 8:30:26 PM No.105980261
the only right answer will always be ISPC
Anonymous
7/21/2025, 8:33:30 PM No.105980295
>>105968706 (OP)
SAS/C / AmigaOS
Anonymous
7/21/2025, 8:34:43 PM No.105980312
>>105980186
that is the wrong way to test for overflow
see >>105979204
Anonymous
7/21/2025, 8:52:28 PM No.105980494
>>105980166
>headers would likely still be needed, they're required when you want to distribute a proprietary shared object/dll while still allowing people to make code that links to it.
At that point it should just call C by foreign function interface and have bindings to the new C++ from it. The library will likely have some kind of C header, it would just make sense to do it the same way Rust does.
Replies: >>105980529
Anonymous
7/21/2025, 8:56:37 PM No.105980529
>>105980494
no it doesn't
Replies: >>105980648
Anonymous
7/21/2025, 9:00:43 PM No.105980566
At work? gcc and linux, while making sure it also compiles with clang and in some cases for windows.
At home? gcc and linux only, I don't give a shit about breakage for any meme system.
Anonymous
7/21/2025, 9:08:45 PM No.105980648
>>105980529
>reeeeeee muh rust bad
no one even talked about rust
they only mentioned rust as an example of a language for binding to C you retard
Anonymous
7/21/2025, 11:09:59 PM No.105981676
>>105980186
ftrapv fwrapv and fsanitize=signed-integer-overflow
do not check for overflow of narrowing conversions.
If you initialized a narrow value from a overflowing value, it will be ignored.
the check is only applied for operations on that value, like addition.
You need -fsanitize=implicit-conversion from clang for this situation, and you may want to enable -fsanitize=unsigned-integer-overflow if you are willing to handle unsigned numbers.
Replies: >>105983349
Anonymous
7/21/2025, 11:25:59 PM No.105981805
>>105968716
Do they use him for the new Epstein, or does he have too much recognition for that?
Anonymous
7/22/2025, 2:28:03 AM No.105983349
>>105981676
not a problem in rust
Replies: >>105983492
Anonymous
7/22/2025, 2:29:50 AM No.105983355
None.
Anonymous
7/22/2025, 2:55:11 AM No.105983492
>>105983349
I would use rust if it didn't look like late stage modern C++ code.
Don't worry anon, I'll probably use whatever the hot jazz programming language people end up using in 10 years.
Ideally something like go but with magical lifetimes (C++ would also have magical lifetimes if that was the case, but I really want to stop using C++, but we need a operating system that's built/re-written with go or something, I think one day, AI could probably do it).
Anonymous
7/22/2025, 3:17:21 AM No.105983643
>>105968706 (OP)
Microsoft's one because it's the only one that supports modules and C++ is unusable garbage without them.