[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

>Professor puts using namespace std; in a header Is it time

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 31
Thread images: 3

>Professor puts
using namespace std;
in a header

Is it time to drop out boys?
>>
>>59680255
No why?
>>
>>59680284
I'm under the impression that it's bad practice, also the fucker requires 2 space indent
>>
>>59680327
Oh he also uses std::endl instead of a newline character religiously, even in fuckhuge for loops
>>
>>59680255
Yes. You should start to work in McDonalds
>>
Can you explain why this is bad
>>
>>59680369
std::endl is actually superior. It flushes the buffer.
>>59680434
It pollutes the global namespace.
Only use in very trivial programs.
>>
>>59680434
Because files that include the header can have name collisions

>>59680470
>flushing the buffer all 10000 times your for loop runs
ok
>>
>>59680255
Just because he did this for some trivial I/O beginner programm doesnt mean he can't code for shit.
Look up his publications if you want to judge him.
>>
>>59680504
His homework auto grader is pretty shit
>>
>>59680369
But you understand the difference, right?
Newline makes new line on Unix.
Endl makes new line based on interpretation in compiler (\r\n on Windows) and FLUSHES the output. If your program dies, non flushed output will not be printed. This is very important to flush once a while.
>>
It's your fault for going to a shit school you dumb nigger
>>
>>59680521
Yes but chaining endl's instead of a bunch of new line characters is cluttered and retarded.
>>
>>59680255
what uni
>>
>>59680504
research and industry are pretty 2 different things
most old professors are slow in coding but many of them are very respectable in their fields
>>
>>59680537
meme state university
>>
>>59680504
>>59680543
He's an adjunct
Also he doesn't reply to emails and I've never seen him before, just his TA slaves.
>>
>>59680255
In college I am very close with a CS professor, one day he saw me doing my coursework with a terminal and text editor, and asked me why I was doing that way, given that most of the class were using the standard IDE, and I told him that I wasn't ready for an IDE becasue I had to learn how things really worked, he agreed with me and explained that he doesn't teach my way because most of the class would have trouble following the course and wasn't worth the trouble. The point I am trying to make is that most college professors just teach the basics for a broad audience with different levels and he isn't the one that will normalize the class (he isn't paid for that) and the reason he might have used it in the header was so that everyone could compile and run without him going to students that needed more attention.
>>
>>59680584
You're a fag, brainlets have no place in university.
>>
>>59680327
Depends on what you're doing I suppose.
>>59680369
My professor did the same thing. Found this write up interesting: http://stackoverflow.com/questions/213907/c-stdendl-vs-n
>>
>>59680567
Hate fags like those. Just gotta put in the time I guess and move on.
>>
>>59680584
Solid point
>>
>>59680255

I don't get why people do that

To access a name space in C++ you just do namespace_name::function_name(arg) and it figures it out
>>
>>59680255
>>59680327
this is how you can tell someone is new

hurr hurr i read somewhere X is bad practice and therefore anyone who does it is stupid

mostly talking about /g/

anyway, in the context of teaching programming, showing a snippet of code, simple programs, using namespace std is perfectly fine when there's no ambiguity or conflict between class and function names
>>
>>59680952
Can we agree 2 space indent is retarded?
>>
File: .jpg (36KB, 720x648px) Image search: [Google]
.jpg
36KB, 720x648px
>>59680255
>236x236
Drop out because you're too fucking dumb to realize that you're saving and posting thumbnails fucking idiot
>>
>>59680957
nope, trivial things like this don't bother any good developer anymore, as long as it is consistent throughout
>>
File: Screenshot_2017-03-31_20-36-59.png (308KB, 1366x768px) Image search: [Google]
Screenshot_2017-03-31_20-36-59.png
308KB, 1366x768px
>>59680972
>>59680255
>its literally smaller than the designated space. 4chan literally has to scale it up
Thumbnail posters should be banned
>>
>>59680481
>>flushing the buffer all 10000 times your for loop runs
There won't be any extra overhead though, since the total I/O operations performed will be the same. All flushing the buffer does is ensure they happen when you expect them to.

>>59680521
Wrong. Newline is interpreted by the compiler to be whatever the newline encoding for your system is.
>>
>>59680952

>using namespace std is perfectly fine when there's no ambiguity or conflict between class and function names
Not in a header.
>>
>professor uses the line method instead of grain of rice method

Is it time to drop out boys?
Thread posts: 31
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.