[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]

Is it normal for ''''''''computer

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: 38
Thread images: 2

File: 6cf[1].png (316KB, 858x725px) Image search: [Google]
6cf[1].png
316KB, 858x725px
Is it normal for ''''''''computer science'''''''(basic c++) courses to have picky bullshit style checkers?
My professor wrote his own style checker and it's absolutely retarded
>submit assignment
>compiles and works perfectly
>500 style errors
REEEEEEEEEEEEEE
Who the fuck uses a 2 space indent jesus christ.
>>
GNU style uses 2 spaces.
>>
>>59137752
GNU style is garbage.
>>
Mr. Shekelstein wants you to learn mainstream styles so when you graduate you'll be able to integrate into Mr. Goldberg's business more smoothly and everybody else can read your code.
>>
>it compiles and runs so my code is perfect
>-I- know better than mr. professor over here, I'm -gifted-
>>
This isn't a CS problem but a university problem. Schools are shit and they don't actually employ people who really teach. Until you reach higher level classes, you're mostly going to be taking a class on the website of the people who published whatever shit-tier textbook they have you using.
>>
>>59137764
you're gonna have to follow the style guide of whatever company you're working at.

It's for your own good.
I hope they're at least teaching you about unit tests and version control.
>>
>>59137776
>>59137803
>>59137801
I'm a math major but my stats focus required me to take this course, I'm actually enjoying it but when I get to this it makes me want to claw my eyes out.
My indentation is consistent and so is my brace placement, but the software throws a fit because it's not the "right" way.
>>
>>59137811
I feel like the course is teaching me bad habits like "using namespace std;" and "endl;"
>>
>>59137847
those don't matter once you go past 10 lines of code.
You won't be making dumb calculator programs after this.
>>
>>59137815
Post a code snippet, let's see what FOSS linters will say.
>>
>>59137629
Consider it preparation for the real world,
where real companies really do this, too.
>>
>>59137863
teaching to use std::endl instead of a newline character is retarded, because when he writes a unix-like tool processing a not small amount of data, he's gonna be flushing constantly which will destroy performance
>>
>>59137815
>>59137847

Sounds like a pretty shit course to be honest but seeing as its a single course, I'd just suck it up and try to do as well in it as you possibly can. You're less invested in it that someone who's in CS, so the shitty habits whoever is teaching you is trying to enforce aren't going to effect your endgame nearly as much. Just get the degree and you'll have forgotten about the course.
>>
>>59137912
If he's writing a unix program, he'll be writing in C.
>>
>>59137629
>2 space indent
Drop out of that college
>>
>>59137866

class Base {
int _value;

public:
Base() {
_value = g();
}

virtual int f() = 0;

int g() { return f(); }
};

class Derived: Base {
public:
Derived(): Base()
{ /* init Derived */ }

int f() { /* implementation */ }
}
>>
It would be a little more tolerable if it actually worked.
One assignment I was using a switch and I had to spend 90 minutes lining it up, in a really ugly way.
Then that night he posts "lol sorry the style checker had the wrong settings, btw if you don't resubmit you get zero points" if I didn't have a copy of the program from before I "fixed" it I would have been furious
>>
>>59137937
lel that's not me
I assume that's really bad code though
>>
>>59137937
surround your code snippets with {code} and {/code} except with brackets instead of braces.
>>
>>59137967
>that's not me
>implying
>>
>>59137967
Then post a snippet
All we have is empty words
>>
File: [code].jpg (6KB, 179x117px) Image search: [Google]
[code].jpg
6KB, 179x117px
>>59137937
>>
>>59137985
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream inputFile;
inputFile.open("secretMessage.txt");
ofstream outputFile;
outputFile.open("decodedMessage.txt");
char c;
inputFile.get(c);
outputFile << '"';
while(inputFile.get(c))
{
if(inputFile.eof())
{
break;
}
if(c>='a' && c<'n')
{
c+=13;
outputFile << c;
}
else if(c>='n' && c<='z')
{
c-=13;
outputFile << c;
}
else if(c>='A' && c<'N')
{
c+=13;
outputFile << c;
}
else if(c>='N' && c<='Z')
{
c-=13;
outputFile << c;
}
else
{
outputFile << c;
}
}
inputFile.close();
outputFile.close();
return 0;
}


This is a "rot13" decoder, don't make fun of me pls. This is an earlier assignment
>>
>>59138031
oh and that outputFile <<'"' and inputFile.eof() was just me being retarded, i figured out those weren't doing anything but I didn't bother to take them out
>>
>>59137866
http://pastebin.com/raw/ZjWhKYcH
>>
>>59137629
Yes it's normal. Idiot.
>>
>>59138031
You don't need to close ios streams, they get closed on object destruction, when they go out of scope.

I'd add some newlines here, it feels densly packed.

I see you're not using a unix-like system, that's sad.
>>
>>59138031
Here's what cpplint.py, the official Google tool your code would have been checked with if you wrote it at Google says about it:
anon.cpp:0:  No copyright message found.  You should have a line: "Copyright [year] <Copyright Owner>"  [legal/copyright] [5]
anon.cpp:3: Do not use namespace using-directives. Use using-declarations instead. [build/namespaces] [5]
anon.cpp:5: { should almost always be at the end of the previous line [whitespace/braces] [4]
anon.cpp:13: Missing space before ( in while( [whitespace/parens] [5]
anon.cpp:14: { should almost always be at the end of the previous line [whitespace/braces] [4]
anon.cpp:15: Missing space before ( in if( [whitespace/parens] [5]
anon.cpp:16: { should almost always be at the end of the previous line [whitespace/braces] [4]
anon.cpp:19: Missing spaces around >= [whitespace/operators] [3]
anon.cpp:19: Missing space before ( in if( [whitespace/parens] [5]
anon.cpp:20: { should almost always be at the end of the previous line [whitespace/braces] [4]
anon.cpp:24: An else should appear on the same line as the preceding } [whitespace/newline] [4]
anon.cpp:24: Missing spaces around >= [whitespace/operators] [3]
anon.cpp:24: Missing space before ( in if( [whitespace/parens] [5]
anon.cpp:25: { should almost always be at the end of the previous line [whitespace/braces] [4]
anon.cpp:26: Missing spaces around = [whitespace/operators] [4]
anon.cpp:29: An else should appear on the same line as the preceding } [whitespace/newline] [4]
anon.cpp:29: Missing spaces around >= [whitespace/operators] [3]
anon.cpp:29: Missing space before ( in if( [whitespace/parens] [5]
anon.cpp:30: { should almost always be at the end of the previous line [whitespace/braces] [4]
anon.cpp:34: An else should appear on the same line as the preceding } [whitespace/newline] [4]
>>
>>59138213
anon.cpp:34:  Missing spaces around >=  [whitespace/operators] [3]
anon.cpp:34: Missing space before ( in if( [whitespace/parens] [5]
anon.cpp:35: { should almost always be at the end of the previous line [whitespace/braces] [4]
anon.cpp:36: Missing spaces around = [whitespace/operators] [4]
anon.cpp:39: An else should appear on the same line as the preceding } [whitespace/newline] [4]
anon.cpp:40: { should almost always be at the end of the previous line [whitespace/braces] [4]
Done processing anon.cpp
Total errors found: 26
>>
>>59138232
The snippet I posted was what the program wanted, not how I originally wrote it.
>>
>>59138260
Look at these warnings - I'm pretty sure it wouldn't classify anyway. The point is that style guides are very subjective, there will always be disagreements, as people like to take them on very personal level.

In comparasion, flint++, the (old) Facebook's linter finds nothing wrong with your code.
===============================================================================
Lint Summary: 1 files

Errors: 0
Warnings: 0
Advice: 0
===============================================================================
>>
>>59137629

that's fucked up
>>
If that's your goal, why not just teach in Python?
>>
>>59137629
my teacher used to give us paper tests in a lab full of computers

he'd hand out single question papers and say write your code here and then he'd hand mark them and hand them back. he refused to use blackboard and refused to let us use a compiler. I thought it was shit at the start but it completely broke the spine of the autistic nerds who thought they were l33t cause they had i7s or macbooks .

after half the class dropped he let us use compilers and it was all good.
>>
>>59138213
anon.cpp:5:  { should almost always be at the end of the previous line  [whitespace/braces] [4]


fuck this
>>
This is the real world op. Installl a linter for your editor that adheres to the rules.
>>
>>59137629
reformat your code with an IDE you fucking retard. Now fuck off with your dumbass student bullshit
Thread posts: 38
Thread images: 2


[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.