Horror

>toString() with side-effects.

Other urls found in this thread:

php.net/manual/en/function.sleep.php
phpthegoodparts.tumblr.com/
bugs.php.net/bug.php?id=45647
eval.in/632529
eval.in/632569
github.com/KeenSoftwareHouse/SpaceEngineers/tree/master/Sources/
github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/ConnectionStatus.java#L213
twitter.com/SFWRedditVideos

In C you have atoi and such.

-> ({wat:008})[[['wat']]] - 010

>prefixing variable names with the name of your company

wait.. what? who does this?

A surprising amount of places. It's usually an acronym prefix, and not the full name. I die a little inside whenever I see it happen.

>20 character long variable names that have ____ as prefix
_____const_var__instance_collector
I had several nightmares because of this when I tried to read C code
I still don't know the purpose of this naming convention

Like with Java and their "jframe"?

It doesn't bother me in the idTech 4 engine, in which classes names are prefixed with id*, But only classes (not pod types nor variables or functions.)

Hiding names. No one is going to search for ____* names when using an API, I think thats why compilers use __* vars. Less risk of name collision

horror langs features (bugs*) ?

>the whole python, every dialect and framework there is related to python
>PYTHON

Nah, mostly companies I work for. I won't say the name, but everything had the prefix "" or "cp".

>VPS users are cpuser
>Projects were called Classes, Lib, etc...
>Databases were cp
>Interface elements were called "cp_"
>Host names were "cp_"
>Accounts were almost always "cp"

It was (and still is) everywhere and it drives me crazy.
I got rid of what I can, but it still riddles all of their projects and practices everywhere.

>In PHP sleep() returns 0 on success, FALSE on error, or when interrupted by a signal returns number of remaining seconds except on Windows where it returns 192

I mean, seriously. It's in their documentation: php.net/manual/en/function.sleep.php

phpthegoodparts.tumblr.com/

Whenever I feel bad about myself, I just remember that people are maintaining PHP.

Do you think pic related is shopped?
See for yourself: bugs.php.net/bug.php?id=45647

Genious.

eval.in/632529

...

It's fun, mind you.

...just never try to debug it. It's ridiculously unpredictable.

>How to confuse most developers

ayy wtf

Here's how you get the right output: eval.in/632569

Good PHP devs are pretty hardcore actually.

They are basically writing things in a non-ironic version of INTERCAL.

Okay, that's just you being a retard for not knowing what a Mersenne Twister is.

If he tried to avoid name collision he fucked up, cause identifiers starting with two underscores are reserved

Here is some things in the code I deal with every day
>using enumerators directly instead of foreach for no reason
>functions that like getHTML() that takes like 5 inputs and modify them by reference and return a generic static string
>static methods inside a non static class to return a new object instead of constructors
>direct bitwise operations on buffers to parse some ints from a file
>multiple versions of the same class just called class1, class2 and class3 which are just copy pasted version of each other with small changes and used in different places

and more that Im probably forgetting

This is sickening

>prefixing variables names with the initials of your company, the initials of your project, and the type of the variable.

>multiple versions of the same class just called class1, class2 and class3 which are just copy pasted version of each other with small changes and used in different places
I die a little inside when I see this.

>prefixing variables names with the initials of your company, the initials of your project, the type of the variable, initials of the author, initials of the CEO, abbreviated form of the variable name, the time the variable was created, and the amount of times the variable is used

>MyClass

Fuck me, I have a coworker that does this shit all the time. I want to murder him.

You just really wanted to reference INTERCAL, didn't you?

You fucking what?

> Test failures
> Expected test failures

>>direct bitwise operations on buffers to parse some ints from a file
Why is this a problem? You have to deal with endianness properly.

how would you do it instead of this?

(Shallow) Inheritance springs to mind. All the common stuff goes in a base class and they all inherit from it.

If similar changes are used on more than one of those, you either compose it in, or make it an interface.

it would be still class1, class2, class3 but with less redundancy

whyyyyyyyyyyy

It should throw an exception but if the documentation stated that all number are valid xxxx-xx-xx then this particular maintainer has a point. The developer who uses the function should just manually check the date.

...

>document.getElementByClassName("name").style.backgroundColor = "rgb(230,230,230)";

Document.prototype.getElementByClassName = function(className){
return this.getElementsByClassName(className)[0] || null;
};

CPanel?

>idCVar, idDict, etc..

No, but same initials.

>realizing 2 weeks before the deadline that 2 very different classes do exactly the same thing

>and they rely on each other

>before
>30 lines of code

>he needed to change 1 line with if statement
>makes
>if
>30 lines of code
>else
>30 lines of the same code with 1 change

>later there was a need for another "if" in one of the lines
>so he doubled the whole thing again
>went to production
>one of the biggest telcos in the world

github.com/KeenSoftwareHouse/SpaceEngineers/tree/master/Sources/

Glorifying global variables.

...

why

This is from the Java MongoDb adapter: github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/ConnectionStatus.java#L213

> Java
> MongoDb

kill me now

>naming your flag _ok
>using a ternary operator instead of a || operator
>just negating the whole thing for extra confusion
>10% of the time just return the result anyway for extra shits and giggles

Fuck this shit, I'm opening up a pub.

...

using namespace std;
using namespace boost;

>Every class that isn't a type uses the singleton pattern
>Your job is to make it multithreaded

What's the problem with this?

Remember that one time Google blocked PHP because malware?

I almost feel it was justified.

...

PHP looks like a nightmare of maintaining mistakes for the sake of backwards compatibility.

Classic

what the.....

if i charged for lines of code would this make me rich?

It would be extremely cost-innefective.

>prefixing your variables with your name, your street address, your credit card information, and your mother's maiden name

malloc is a side effect

Blame C for not having namespaces* and for the preprocessor being retarded.

*or similar, it could as well be a simplified struct syntax

It's UB

singletons can still be okay if they exist to provide methods and have little to no state

What does this do?

Not if you used like a bash script to generate the if-statement

>Less risk of name collision
If your code is standard C then there is 0 chance of name collision.

Sony does this. A lot.

boost has similar functions as std, I believe some of them have the same identified (cos, sin)?

Someone correct me here, haven't C++'d in a decade or so.

except C does have namespaces.
namespace_foo()

And this is exactly what they did, consider killing yourself.

I once spent 2 days debugging a crash
The problem was that libmariadbclient had a internal function named my_init used for initialization, but gcc for some unknown reason added another function named my_init called by __libc_csu_init

When libmariadbclient was initialized it called the my_init added by gcc because of the name conflict, so it was never initialized properly

Shit like this makes me hate the lack of proper separation in C

Which division? I never noticed this in the TV division.

You know nothing about horror.
Background: Engineering company, deals with capacitors, resistors, inductors, etc.
>Very precise values, like 0.000000000000000000000000000000000000000000000000012312310001231
>SQL Server deals with such by converting them to scientific notation (product company bought uses SQL server).
>They do not want their data to be represented in scientific notation.
>Some legacy java code (they don't want to change it, lots of dependencies) is unable to deal with it. getBigDecimal can sort of make it but it will add additional values because apparently, 1+1 = 1.0000000000000000000001231 or whatever.

How I dealt with it? In my result set query, I forgot exactly how but it went on like this: select cast 0 as space trim replace space as 0 * .0000001 cast replace trim cast replace trim something something. All I remember is that there were multiple cast, replace, and trim calls in one column.
I don't know how I did it but it worked and they're happy with it. Using native java code to deal with it was a bitch to work with since you had to specify a certain amount of decimal points, and our data varied from 1000000000000000 to .000000000000000000000000000000000000000000000000012312310001231.

>convert very precise number to base64 before uploading to SQL table
>no more scientific notations
that wasn't so hard
where is my $100k/year job?

This is in Java.

Whaat? GCC generated a conflict?

I know GCC does some weird things, but that takes the cake.

lmao

Base class the others inherit from.
Then each separate class named after what it's good for.

Or a single class with multiple init methods for the different use cases.

No wonder companies want to hire pajeets, they can't possibly get any worse.

>Base class the others inherit from.
This is fine.

>Or a single class with multiple init methods for the different use cases.
Unless they really are meant to be the same thing, don't do this.

>VRage what do they mean by this?

NVIDIA, but not all variables
>typedef NvU64 uint64_t
>NvAPI
>build script called nvmake
>most struct names are prefixed with Nv
it's kinda cute desu

This I really don't mind much. For example, Unity engine has many classes that collide with important classes the system library (Object, Random, to name a few), which is extremely irritating. In contrast, Unreal avoids this by using a U prefix on most things. Why is this such an issue?

>convert very precise number to base64 before uploading to SQL table
Hint
>(product company bought uses SQL server)
That was how the product was designed, even if we wanted to, we weren't able to make changes to it.

4u

Why C became the predominant systems programming language back in the day when much better languages like Pascal existed beats the hell out of me.

Well, Pascal WAS the language used for the Classic Mac OS.

Apple's worst technical mistakes were switching from that to the inferior Unix base and later switching from a RISC architecture to the light years behind x86 architecture.

>Pascal
Pascal had it so rough over the years. It's a shame too because it was surprisingly really good.

>things don't work
>how to make it work without changing anything???

kys

>that guy at work who loves singletons

>Both previous lead developers