Author Topic: Programming Megathread  (Read 144059 times)

Talking about how you use brackets and white space is always a good way to get people riled up. I had a professor start this debate to get the class going once and everyone got pretty into it.
Ahhh, so it's turning into the Programming Bait thread then

I don't like that, either
it's another case of getting confused while skimming. the else being on the same line as the closing bracket makes me think it's just more code in the initial if

But it loses an indentation level so it's clear that the if has ended, then since immediately it is indented obviously it's entered an alternative control flow. It actually makes it easier for me to identify else statements while skimming because if there's only one line that loses indentation then the next line is the else clause, versus if it's another if statement it follows a different form:


if(x == y) {
  // foo
}
if(x == z) {
  // bar
}

Talking about how you use brackets and white space is always a good way to get people riled up. I had a professor start this debate to get the class going once and everyone got pretty into it.
braces*****

But it loses an indentation level so it's clear that the if has ended, then since immediately it is indented obviously it's entered an alternative control flow. It actually makes it easier for me to identify else statements while skimming because if there's only one line that loses indentation then the next line is the else clause, versus if it's another if statement it follows a different form:


if(x == y) {
  // foo
}
if(x == z) {
  // bar
}

even though its been my style since forever same line braces can lead to line noise sometimes imo. lately ive been writing a lot of js and i dont give a forget anymore. indentation is the correct way to read code however so meh
0x90
nice meme fam. do you have a job yet?

"i should probably test the API i've been writing"
https://github.com/TheBlackParrot/strimmer-nwjs
http://i.imgur.com/EpkQAdI.png

i'm probably not even using nwjs to its full extent but w/e

pet peeve: not putting a space after the "if" before the parenthesis
it's not a function -___________-

pet peeve: putting a space after the "if" before the parenthesis.

pet peeve: putting a space after the "if" before the parenthesis.
i hate this i hate this i haaaate this

pet peeve: putting a space after the "if" before the parenthesis.
Visual studio does this automatically and it makes me unsettled.



I format ifs like this
Code: [Select]
if() {
    //Stuff
}

And I loving hate this format
Code: [Select]
if()
{
    //Stuff
}
« Last Edit: February 10, 2016, 12:21:38 PM by blueblur121 »

Im taking a C++ elective at my college because it's required for my degree and this is my last semester. It just took me 40 minutes to make a 7 line program that averages three test scores, I hate this lol.


"i should probably test the API i've been writing"
https://github.com/TheBlackParrot/strimmer-nwjs
http://i.imgur.com/EpkQAdI.png

i'm probably not even using nwjs to its full extent but w/e
why do you use nwjs over electron? I've always used the latter and am curious.

Im taking a C++ elective at my college because it's required for my degree and this is my last semester. It just took me 40 minutes to make a 7 line program that averages three test scores, I hate this lol.
Converting types in C++ is a lot of fun when you're using a framework.

Code: [Select]
if (fileExists(filepath))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString("Reading file."));
std::fstream file;
file.open(filepath, std::fstream::in);

char check;
std::string buffer;
FString convertString;
int32 value;

int32 key = 0;
while (file.good())
{
check = file.get();
if (check == '\n')
{
convertString = buffer.c_str();
value = FCString::Atoi(*convertString);

AdjacencyCache.Add(key, value);

buffer = "";
continue;
}
else if (check == '.')
{
key++;
continue;
}
else if (check == '\r')
continue;
else
buffer = buffer + check;

}
}

(Shown: Reading a file and converting between char* -> std::string -> FString just to read data from a file into an array.)