klimi
come to #OT and post your error messages there
Caesy
Ok
Anonymous
I have a USB stick that I can't access its contents, giving some funny errors.// if u use it with a linux system dmesg should tell u the issue
Anonymous
if i declare age variable first then the string prompt wouldnt work! any help
Anonymous
this is the output
Anonymous
if i declare string variable first then the output works
Francisco
if i declare age variable first then the string prompt wouldnt work! any help
Can you send the code through a pastebin/compiler explorer link?
Noor
Do you guys code like this now days? auto main() -> int { return 0; }
MᏫᎻᎯᎷᎷᎬᎠ
I think it's because of how streams works When you enter with cin it leaves the '\n' in the stream, which is read by std::getline
MᏫᎻᎯᎷᎷᎬᎠ
Francisco
Do you guys code like this now days? auto main() -> int { return 0; }
I'm aware Clang Tidy recommends this, but it feels really weird and I turn that recommendation off
MᏫᎻᎯᎷᎷᎬᎠ
I'm aware Clang Tidy recommends this, but it feels really weird and I turn that recommendation off
I think this is the standard for most of modern Language Since the programner needs to understand this is a function
Francisco
It is configurable
I know, that's what I meant when I said "turn off"
Noor
I'm aware Clang Tidy recommends this, but it feels really weird and I turn that recommendation off
Indeed, its like writing rust than C. Then we also got modules things this is like were starting leave C zone.
Francisco
Indeed, its like writing rust than C. Then we also got modules things this is like were starting leave C zone.
The further we move from C, the better the language will get. Meanwhile, many developers have to get used to the new features
Francisco
I like trailing return, but it still feels a bit weird in the main function
Francisco
And I'm craving for modules, but no compiler implements them yet
Noor
And I'm craving for modules, but no compiler implements them yet
Wdy mean? latest gcc and clang support it and msvc already support importing std library. with -std=c++2a
Artöm
Latest gcc is 9 and it has no modues support
Francisco
Neither of them have complete support for modules
Zel
Seeings as I use GCC and have no idea what modules are.....
Techno
Guyz my laptop freezes on startup and after it goes to sleep can someone help please
Artöm
Even clang 11 has partial modules support rn
Techno
I contacted customer care but no use
Francisco
Im using it already with clang
Still no full support for modules in clang
Anonymous
Do you guys code like this now days? auto main() -> int { return 0; }
https://stackoverflow.com/questions/11215227/should-the-trailing-return-type-syntax-style-become-the-default-for-new-c11-pr obviously no one is stopping you from using it all the time
Artöm
Even clang 11 has partial modules support rn
https://clang.llvm.org/cxx_status.html
Anonymous
#OT
Techno
What os?
Windows
Techno
Windows
10 pro
Pisswasser
How can we create an array of random numbers without any identical elements inside it ?
Pisswasser
In c++
Anonymous
if i put the int age variable below the string (name variable) it works
Francisco
How can we create an array of random numbers without any identical elements inside it ?
It depends what your preferences are: - You can add random numbers to a std::set until you reach the desired size, and then move the content into the array. It's fast, but non-deterministic. - You can create a list with all the possible numbers and extract one random every time or shuffle and select the k first. It's not that fast, but it's deterministic.
Francisco
https://pastebin.com/raw/t3ZcUTJy
MᏫᎻᎯᎷᎷᎬᎠ
Weird nobody ever mentioned Epochs IMO it's the most devastating feature C++ will get
MᏫᎻᎯᎷᎷᎬᎠ
I hope it reaches 23
MᏫᎻᎯᎷᎷᎬᎠ
Time to clean up the language with a better modern broom, not just features to fix other problems of other features
Francisco
Weird nobody ever mentioned Epochs IMO it's the most devastating feature C++ will get
I like that feature, but it's quite unlikely it will make into the standard any time soon. Many commitee members poined many flaws on the proposal
Francisco
I don't really know the details, I just know they discussed it and agreeded it needed further fixings
MᏫᎻᎯᎷᎷᎬᎠ
All their minds have been resolved They just don't wanna get tired
MᏫᎻᎯᎷᎷᎬᎠ
Most of their objection about the language modules based dialect
MᏫᎻᎯᎷᎷᎬᎠ
Which is the core problem Epochs came to solve
Francisco
I think the standard has three possible, orthogonal directions to take in the near future: - Break ABI and fix a lot of stuff in the language. Here, epochs would be quite unnecessary. - Implement epochs, so breaking ABI is not necessary, at the cost of implementing a really big feature, which may need many years to get right. - Don't do anything and let the language die slowly
Francisco
And now most of the debate is around breaking ABI or not, so epochs will have to wait
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
It'll get complex in time Other Languages gets easier and more productive with the same pros of C++
MᏫᎻᎯᎷᎷᎬᎠ
Yeah I'm talking about Rust, zig..etc
Francisco
The problem with C++ is legacy code, like with any other old language. The problem C++ has and C doesn't is that C makes sure that ABI compatibility is matained through versions. This gets difficult with C++, as overloading, default parameters and templates break ABI with any minimal change. But people still choose C++ for performance reasons, so many people in the standard are in favor of breaking ABI in ordet to allow better performance
Francisco
But breaking ABI would surely affect many old codebases
Francisco
And that's the core of the debate
MᏫᎻᎯᎷᎷᎬᎠ
Francisco
There were problems when the layout of std::string was changed in C++11, because that broke ABI, and therefore a lot of pre C++11 codebases
Francisco
So yeah, the standard is afraid of breaking ABI
MᏫᎻᎯᎷᎷᎬᎠ
Francisco
what programming languages solve this issue?
If you're asking about backward compatibility, the answer is none of them. Backwards compatibility hits you sooner or later. If you don't care about it, less people will be interested in you language for big projects. If you're too conservative, the language evolves really slow
MᏫᎻᎯᎷᎷᎬᎠ
yeah i mean
Rust and it's ecosystem with Edition
Francisco
Rust implements editions, which aim to fix this problem, but it's such a young language that nobody really knows how it will evolve in the long run
Asad
Rust and it's ecosystem with Edition
i don't think that it can be the next c++ or c
MᏫᎻᎯᎷᎷᎬᎠ
i don't think that it can be the next c++ or c
There's a high possibility it will
Asad
system development will always require C
MᏫᎻᎯᎷᎷᎬᎠ
system development will always require C
Someone can just implement his/her own POSIX-like standard and bye
Francisco
There's a high possibility it will
It's too soon to claim that a five-year old language is gonna substitute a 30+ years old language. We'll have to wait for a couple years to see how really old codebases react to new changes
Francisco
It's legacy code what kills any language out there
Dima
C++ is C++ and Rust is Rust lol
Francisco
C and C++ have survived for so long that it makes you think they made a lot of good decisions in the past