Message from @DanielKO
Discord ID: 463132412059320321
```cpp
#include <iostream>
int main()
{
std::ios::sync_with_stdio(false);
std::cout<<"a\n";
std::printf("b\n");
std::cout << "c\n";
return 0;
}
```
@meratrix what do you expect the output to be?
```cpp
std::ios::sync_with_stdio(false);
```
wut dis do?
compile and find out 😉
Nah nigga
it's some cool shit
b
a
c
Okay, I'm assuming that first line does some fuckery.
Wait, why are you doing ios related programming
Blech
Also i hate when people dont use “Using namespace std;” and just type std: a bagillion times
You shouldn't use namepsace std; in actual software.
do you suggest `using std::cout;` or something?
`Using namespace std;` is bad for actual software, generaly fine for small side projects, because if you're using libraries and they happen to have them named the same, say they both have their own `String`, then it's going to cause issues when you `Using namespace String`.
polluting namespace is bad mmkay
clang-tidy/format are great
That method, `std::ios_base::sync_with_stdio()`, controls whether the standard stream objects `cin`, `cout`, `cerr`, `clog`, `wcin`, `wcout`, `wcerr`, `wclog` are synchronized with `stdin`, `stdout`, `stderr`.
If you turn synchronization off, you might get better performance in `cin`, `cout`, etc.
If you're just using the standard library, don't worry about `using namespace std;`.
So yes, `using std::cout;` is a more controlled way to do it.
I agree, when I was taught c++, we were told to have ```Using namespace std;``` and it took me a while to get out of the habit of it later
I say, never overlook possible excuses for a programmer to copy-paste shit. If it gets too verbose, you can be a good fraction of programmers just copy-pastes shit to avoid typing.
```cpp
void dump_debug_stats(const Data& d)
{
using namespace std;
...
clog << "Data Type: " << setw(4) << hex << uppercase << setfill('0') << d.type << "\n";
clog << "\tpayload: " << setw(12) << setfill(' ') << right << d.payload
<< "\ttimestamp:" << setw(20) << dec << d.timestamp << "\n";
}```
This is an example of a justified use of `using namespace std;`.
Because if you say "always use `using std::somename;`", you know what's going to happen. Some idiot will create one single header, `usingstd.h`, and fill it with
```cpp
using std::cout;
using std::cin;
using std::endl;
using std::sqrt;
using std::string;
using std::vector;
...
```
Yeah, but what you're taught is usually shortcuts that aren't always used in production.
There are many style guides out there that would castrate you for not following if you're working with a team for software design.
There is a reason you refactor codebases more than you actually implement more functionality.
those eyes...
mfw using split on visual studio
Or the standard layout. I don't need like 3 output windows, repo, and project directories on startup. pls.
I'll only use VS for large projects I actually need intellesense.
Otherwise atom.
Most stuff I do doesn't need a massive IDE though.
@Deleted User Ironically, I just got done today working on the largest Excel spreadsheet I've personally ever made.
why?
I was helping my mother who is the sustainability manager of our county, and they've basically thrust some of the light work their data scientist should be doing onto her. Her, being a 57 year old middle aged white woman, has no fucking clue what she's supposed to do. So I help her with that stuff. @Deleted User
It's a lot of writing formulas to calculate percent change when reducing electricity usage in certain areas.