When you realize how dumb a bug is...

Started by
150 comments, last by Juliean 7 years, 5 months ago

You've just gained +5 development points in the programming skill-tree.

You've also suddenly realised why all the people who complain about Python's syntactically-significant whitespace are wrong ;)

And why you should enable a strict warning mode and warnings-as-errors in C++. That code should be a compile time error :)

Advertisement

You've just gained +5 development points in the programming skill-tree.

You've also suddenly realised why all the people who complain about Python's syntactically-significant whitespace are wrong ;)

And why you should enable a strict warning mode and warnings-as-errors in C++. That code should be a compile time error smile.png

I use /Wall (except for PCH and few codes like automatic inline and padding) on MSVC2015 but it didn't warned me :\

EDIT: even the static analyser does not warn :\

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/


I use /Wall (except for PCH and few codes like automatic inline and padding) on MSVC2015 but it didn't warned me :\

EDIT: even the static analyser does not warn :\
Really? You should get e.g.:

1>------ Build started: Project: engine (Visual Studio 2010), Configuration: Dev Win32 ------
1>  Model.cpp
1>..\..\src\gx\Model.cpp(319): error C2220: warning treated as error - no 'object' file generated
1>..\..\src\gx\Model.cpp(319): warning C4390: ';' : empty controlled statement found; is this the intent?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I use /Wall (except for PCH and few codes like automatic inline and padding) on MSVC2015 but it didn't warned me :\

EDIT: even the static analyser does not warn :\
Really? You should get e.g.:

1>------ Build started: Project: engine (Visual Studio 2010), Configuration: Dev Win32 ------
1>  Model.cpp
1>..\..\src\gx\Model.cpp(319): error C2220: warning treated as error - no 'object' file generated
1>..\..\src\gx\Model.cpp(319): warning C4390: ';' : empty controlled statement found; is this the intent?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I just tested in an new project and it warns. Looks like there is a setting in the original project that causing some issues... More research are needed ph34r.png

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/


I use /Wall (except for PCH and few codes like automatic inline and padding) on MSVC2015 but it didn't warned me :\

EDIT: even the static analyser does not warn :\
Really? You should get e.g.:

1>------ Build started: Project: engine (Visual Studio 2010), Configuration: Dev Win32 ------
1>  Model.cpp
1>..\..\src\gx\Model.cpp(319): error C2220: warning treated as error - no 'object' file generated
1>..\..\src\gx\Model.cpp(319): warning C4390: ';' : empty controlled statement found; is this the intent?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I just tested in an new project and it warns. Looks like there is a setting in the original project that causing some issues... More research are needed ph34r.png

OK, I found the arcane issue: the PCH was setted to /W0 instead of /W4.... Why does the PCH warning level interfere with the rest of the project? .---. Another mystery of Redmond..

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

I just made the following mistake:


PlayerPrefs.GetString(key) ?? defaultValue;
Unity's PlayerPrefs.GetString returns "", not null, if the string does not exist yet. sleep.png

Why not use PlayerPrefs.GetString(key, defaultValue)?

I just made the following mistake:




PlayerPrefs.GetString(key) ?? defaultValue;
Unity's PlayerPrefs.GetString returns "", not null, if the string does not exist yet. sleep.png

Why not use PlayerPrefs.GetString(key, defaultValue)?


defaultValue in this case was actually a property with a few side effects that I didn't want to call unless the string didn't exist yet.

You've just gained +5 development points in the programming skill-tree.

You've also suddenly realised why all the people who complain about Python's syntactically-significant whitespace are wrong ;)

But then it's a pain to move code around since you need to ensure you didn't accidentally miss anything when readjusting the identation, and don't get me when tabs and spaces start getting mixed (not as stupid as it sounds, some programs do it on purpose behind the scenes to reduce memory usage)

For all the flak they get, this is something modern BASIC variants (the ones with structured constructs) get right. Indentation doesn't matter, but sentences always implicitly end at a newline. Multiline sentences are the exception to the rule and need a symbol explicitly extending them. This makes programmers less likely to screw up something like this (you aren't adding semicolons without giving it a thought)

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

I've had an SSD that was failing to be recognized for weeks, and before I shipped it back (Filled out the RMA and got a label), windows updates turned off my computer.

When I booted it up, the SSD was working fine. I just needed to power cycle the SSD to fix it, and i hadn't even turned off my computer in weeks.

I did something akin to the following


IEnumerator MyCoRoutine()
{
   While(Blah == true)
   {
       ...
   }

   yield return null;

}


Whoops, infinite loop ahoy! And Unity is single threaded. Luckily I just attached a debugger, and made Blah false.

This topic is closed to new replies.

Advertisement