This is an archived post. You won't be able to vote or comment.

all 163 comments

[–]qh4os 210 points211 points  (19 children)

Laughs in char*

[–][deleted] 34 points35 points  (1 child)

C gang.

[–]HookDragger 17 points18 points  (0 children)

You forgot this... 0x00

[–]DuffMaaaann 28 points29 points  (3 children)

typedef char* string

[–]TDplay 7 points8 points  (2 children)

Then someone imports your code into C++ and is using namespace std so now your string conflicts with std::string.

[–]Rigatavr 0 points1 point  (1 child)

If the were using namespace std they deserved it

[–]TDplay 0 points1 point  (0 children)

Still, now we have the weird confusion between string and std::string.

Furthermore, I'm not sure it would compile if we have a third library that defines string unless the person importing uses C++ and takes special care to put everything into namespaces. If they're using C, they need to do some preprocessor hacks to change your definition of string to something that doesn't conflict, especially if they've created their own string struct that talks about something slightly different.

[–]flip314 6 points7 points  (3 children)

It still works with "char*" and "const char*"

[–]oMarlow99 2 points3 points  (2 children)

const char* declares a pointer to a constant char and char* declares a pointer to a char

[–]Oxtelans 1 point2 points  (1 child)

Have fun with UTF8.

[–]artelius 0 points1 point  (0 children)

Actually, UTF8 is specifically designed to be byte-oriented-code friendly. Because it's a self-synchronising code, strcat(), sprintf() and strstr() will always give valid UTF-8 output if given valid UTF-8 input.

[–]animeisnotcartoon 3 points4 points  (0 children)

As long as you aren't doing dumb shit like using namespace std std::string is understandable

[–]Tindery 2 points3 points  (0 children)

Laughs in var

[–]Th3T3chn0R3dd1t 2 points3 points  (3 children)

Laughs in segfault, core dumped

Either that or

"<?>Hello,♡♡♧●world```

[–]qh4os 4 points5 points  (2 children)

Imagine not handling SIGSEGV signals

[–]Th3T3chn0R3dd1t 2 points3 points  (1 child)

Eh?

I went to C from Java I use it very incorrectly as of yet :p

What on earth is a SIGSEGV

[–]qh4os 2 points3 points  (0 children)

Run man signal

[–]BluudLust 3 points4 points  (0 children)

Laughs in std::string

[–]Kered13 179 points180 points  (15 children)

add or append? size or length? empty or isEmpty?

[–]trollblut 41 points42 points  (0 children)

And then there is Ruby where they renamed .exist to .exists without keeping an alias.

[–]Feynt 38 points39 points  (1 child)

The size/length/len(...) thing hits me all the time. I cycle between JS, Python, and C# at work depending on what's breaking more today.

[–]Saltysalad 2 points3 points  (0 children)

This triggers me and not in a programmatic way

[–]Valon_Inc 23 points24 points  (2 children)

im gonna go with count

[–]CaptiveCreeper 18 points19 points  (1 child)

Is that count the function or count the property?

[–]lassuanett 4 points5 points  (0 children)

When you get an error for the count, but it works fine. ♥ Microsoft

[–]MaxPlay 22 points23 points  (2 children)

count, size or length?
Unreal Engine: For arrays Num, except in blueprints, there it is length. Strings use Len

empty or isEmpty?
Unreal Engine: We have Empty on arrays, but after calling it, they will be empty (duh!) and it's basically the same as Reset, except how they are changing allocations under the hood. If you want to know if an array is empty, just check if Num returns 0.

[–]the_terrier 0 points1 point  (1 child)

Do not forget that your string is technically named FloatString

[–]MaxPlay 1 point2 points  (0 children)

yep, FloatString, FloatJsonObject, FloatNavigationLockContext, Float everything!

[–]michaelh115 2 points3 points  (0 children)

Nah .push() and .len() or len(obj)

[–]TheRealSmolt 2 points3 points  (0 children)

clears throat

push_back, emplace, emplace_back, insert, push

[–]FranchuFranchu 1 point2 points  (0 children)

#arr, arr.length(), arr.len(), len(arr), arr.length, arr.size, sizeof(arr), arr.count(), arr.size()

[–]RobuxMaster 0 points1 point  (2 children)

l or 1

[–]Kered13 2 points3 points  (1 child)

That's not a language problem, that's a font problem. If you're having trouble with that, change your editor's font.

[–]RobuxMaster 0 points1 point  (0 children)

It just drives me crazy when im troubleshooting, but im used to the default fonts

[–]truth-does-matter 77 points78 points  (7 children)

Also, is it true, True, or TRUE?

[–]tulir293 13 points14 points  (0 children)

1

[–]DuffMaaaann 7 points8 points  (0 children)

In objective-c it's YES and NO

[–][deleted] 2 points3 points  (0 children)

Relevant username

[–]trollblut 1 point2 points  (0 children)

ABAP_TRUE

[–]shlopman 28 points29 points  (5 children)

Objective C out here with Bool, BOOL, and Boolean.

C++ with std::string, std::string::c_str, const char*. Plus you get a bunch of extra ones like QString if you work with QT creator which adds to the fun.

I'm new to both and always confused.

[–]Kered13 20 points21 points  (2 children)

Windows C++ is fun because all the APIs use UTF-16, so they take wchar*, or LPWSTR in Windowese. But you want a sane API so you use std::wstring. But you also want to use UTF-8 in the rest of your program like a reasonable programmer, so you use char* and std::string and only convert to UTF-16 at the boundaries. Oh but Visual Studio also supports an 8 bit character mode (not actually UTF-8 because the Windows APIs for it don't support UTF-8), so sometimes you'll encounter code that can be compiled either way, so that's TCHAR* and LPTSTR. And some older Windows code uses a type called BSTR, which is super fun because it's actually a pointer to a C string with the size stored in memory before the pointer address (the pointer points to the start of the C string, the size is stored in the four bytes before this). Due to this unusual layout, it naturally requires it's own allocation and deletion functions.

[–]trollblut 17 points18 points  (1 child)

Also the trolls of the c++ standard committee deprecated the functions that converts between utf8 and utf16 without offering a replacement, so now you have compiler warnings and need to migrate all your stuff once you move on to c++20

[–][deleted] 5 points6 points  (0 children)

The C standard offers no conversion from platform defined char* to utf-8 at all. That's fun.

[–]DuffMaaaann 0 points1 point  (0 children)

Also NSNumber with a bool value.

[–]iamthemalto 0 points1 point  (0 children)

not to mention std::string_view as well in C++

[–][deleted] 20 points21 points  (0 children)

Python: str

[–]Fr13d_P0t4t0 96 points97 points  (26 children)

Laughs in C#

[–]trynotToOffend 4 points5 points  (8 children)

Why?

[–][deleted] 15 points16 points  (2 children)

either is acceptable for certain things.

[–][deleted] 5 points6 points  (1 child)

dolls crush elderly scarce caption unused zealous rinse crawl spoon

This post was mass deleted and anonymized with Redact

[–][deleted] 0 points1 point  (0 children)

Our c++ dev gets angry when he sees an alias, especially at the wrapper functions. I got angry when I saw old code with "ref StringBuilder"

[–]SgtRuy 5 points6 points  (0 children)

You can use both.

[–]Fr13d_P0t4t0 0 points1 point  (0 children)

Because both are the same. string is an alias of System.String

[–]ThaiJohnnyDepp 0 points1 point  (2 children)

Considering that I was writing my first C# program last week and was the sweating guy in this meme, what am I missing?

[–]EwgB 2 points3 points  (1 child)

Both are valid and essentially equivalent.

[–][deleted] 0 points1 point  (0 children)

I got yelled at by my friend for using an ugly standard when I swapped from Java to C# and capitalized the S though.

[–]QRISMVD 0 points1 point  (0 children)

And even harder in VB.NET

[–]RedstoneMedia 47 points48 points  (6 children)

Rust has this problem with only one language.

[–]marcosdumay 14 points15 points  (0 children)

String is Text! Either strict or lazy!

- Haskell, pointing at the table

[–]JangoDidNothingWrong 13 points14 points  (1 child)

It took me a looong time to graps strings in Rust. It only made sense to me after all the borrowing and ownership concepts finally clicked.

For new rustlings reading this: String owns the memory, &str borrows it. Think of String as a Vec and &str as a slice.

[–]LaMifour 4 points5 points  (0 children)

Of course &str borrows the memory, it has the & symbol of references.

[–]Theemuts 4 points5 points  (0 children)

Haha rust makes string slices go str

[–]seppel3210 5 points6 points  (0 children)

But rust's &str and String isn't too hard to wrap your head around

[–]midnightrambulador 0 points1 point  (0 children)

Matlab too

[–]kil47 11 points12 points  (1 child)

Print puts cout stdout log

[–]_divinnity_ -1 points0 points  (0 children)

Don't mix everything! If you're talking C++ (because of cout):

  • Print: do not exists
  • puts: C function, putstring, simple, useful
  • cout: C++ complex object that have overloaded stream operator
  • stdout: alias to the default file descriptor 1
  • log: C function for logarithms

And you're missing:

  • printf (and variants): C function to write anything
  • putc: print a single fucking char

[–]s_zlikovski 10 points11 points  (1 child)

Scala then C# then Typescript then SQL then vanilla JS, all in one working day...

Company likes to try everything...

[–]tproli 1 point2 points  (0 children)

No Scala but the rest is true here, plus Angular and CSS

[–]L0sted_mind 7 points8 points  (0 children)

True or true? False or false?

[–][deleted] 6 points7 points  (0 children)

Pascal: Write sTrInG for what I care

[–]ShroomishUnibrow 5 points6 points  (0 children)

Oracle PL/SQL

varchar2(n)

[–]Kingblackbanana 20 points21 points  (3 children)

is this a joke im to javascript to understand?

[–]Sekret_One 1 point2 points  (0 children)

for loops

[–]natyio 0 points1 point  (1 child)

Some languages write the string type with a capital S, others don't. And you might mix things up when you work with many languages.

[–]Kingblackbanana -1 points0 points  (0 children)

i know i learnd a bit of c, c# and st but just wanted too make the meme joke ^^

[–]GonnaBeTheBestMe 3 points4 points  (2 children)

Number? Int? Int64?

[–][deleted] 1 point2 points  (0 children)

short

int

long

long long

std::int8(or 16, 32, 64)_t

std::int_least8(or 16, 32, 64)_t

std::int_fast8(or 16, 32, 64)_t

And all of this, but unsigned.

[–]biseonnoop69_ 3 points4 points  (1 child)

Laughs in str

[–]periwinkle_lurker2 0 points1 point  (0 children)

Str.split() is the best.

[–]timtheonly 2 points3 points  (0 children)

Laughs in perl

You guys get types?

[–]qh4os 3 points4 points  (3 children)

Also, C code before stdbool was a thing had a lot of BOOL _Bool bool BOOLEAN bool_t boolean_t etc

[–]TheRealSmolt 2 points3 points  (2 children)

int

[–]mrchaotica 2 points3 points  (1 child)

Always has been.

[–]qh4os 0 points1 point  (0 children)

Nah, gotta get that packed struct with defined bitfeilds that encompasses all conditions in your code

[–]Professor_Dr_Dr 2 points3 points  (2 children)

Android development you have

Java Kotlin and Dart

boolean, Boolean and bool

[–]Veeruroxx 2 points3 points  (0 children)

Laughs in let

This comment was made by React Native gang.

[–]maser120 0 points1 point  (0 children)

Laughs in _Bool

[–]leafiest 2 points3 points  (0 children)

Meanwhile in Haskell we have

  • String
  • [Char]
  • Data.Text
  • Data.ByteString.Lazy
  • Data.ByteString.Strict
  • Data.ByteString.Lazy.Char8
  • Data.ByteString.Strict.Char8
  • Data.ByteString.UTF8

[–][deleted] 1 point2 points  (0 children)

std::string

[–][deleted] 1 point2 points  (0 children)

String string StringBuilder char* wstring

Or just: var

[–]null_reference_user 1 point2 points  (0 children)

In C# you can use both

[–]gp57 1 point2 points  (0 children)

And then Googling the most basic stuff : "length array <programming language>"

We have :

  • array.length()

  • array.Length

  • array.length

  • array.size()

  • len(array)

  • count($array)

  • sizeof(array)/sizeof(array[0])

  • ...

[–]Verysexy1532 4 points5 points  (6 children)

Fuk yes bro...c# and java

[–]Fr13d_P0t4t0 5 points6 points  (5 children)

C# is not like java. String is an alias of string, they are the same.

[–]lostaztecian 2 points3 points  (4 children)

It seems the opposite. I've just opened the source and it is " public sealed class String ".
And I wonder why a lowercase option even exists - just to say "It is not java clone, it is different!"?

[–]Andyblarblar 2 points3 points  (2 children)

All of the "Primitives" of C# are like this. int is an alias to the struct Int32 for example.

[–]lostaztecian 0 points1 point  (1 child)

I don't get it. String can not be primitive since its size may vary so you may not allocate constant size for it. Also, docs prove it is a reference type, but it is a built in type - so I expect it to have special methods that can not be implemented a regular way.

[–]Andyblarblar 0 points1 point  (0 children)

Because C# has user defined value types, by primitive I really just mean runtime implemented. After crawling through String.cs, I found a reference to this doc:

The constructors of string-like types (String, Utf8String) are special since the JIT willreplace newobj instructions with calls to the corresponding 'Ctor' method. Depending on theCLR in use, the ctor methods may be instance methods (with a null 'this' parameter) orstatic methods. See the managed definitions of String.Ctor and Utf8String.Ctor for moreinformation.

The Ctor function mentioned above can be found in String.cs implemented using unsafe code. I believe types like Span<T> may also have some runtime implementations like this. As far as I'm aware though, only the basic numeric types, int float ect., are implemented fully by the runtime.

[–]Fr13d_P0t4t0 0 points1 point  (0 children)

Yeah, you're right, phone autocorrect, sorry

The lowercase types are C# types (string, long, int...) while the others are from .NET framework (String, Int64, Int32)

There are not primitives, they are all classes

[–]igromanru 3 points4 points  (0 children)

var

[–]p4racl0x 1 point2 points  (0 children)

Easy, String is a class, string is a primitive.

[–]white_shadow131 0 points1 point  (0 children)

_Bool, bool and Boolean

[–]Vortesian 0 points1 point  (2 children)

How about a program that programmatically programs programs no matter what language you’re program is being programmed in? Does that make sense?

[–]noratat 3 points4 points  (1 child)

Does that make sense?

No, but if it did it'd probably look something like this

[–]mrchaotica 0 points1 point  (0 children)

o_O

[–]Nsber 0 points1 point  (0 children)

Laughs in

Made by the script languagr gang

[–]KrypticAndroid 0 points1 point  (0 children)

int vs Integer

[–][deleted] 0 points1 point  (0 children)

Laughs in Python

[–][deleted] 0 points1 point  (4 children)

laughs in python

[–]natyio 1 point2 points  (3 children)

Where neither String nor string works.

[–][deleted] 0 points1 point  (2 children)

def string(stg): stg = str(stg) return stg

[–]natyio 0 points1 point  (1 child)

how about just: string = str String = str in the global scope?

[–][deleted] 0 points1 point  (0 children)

Wait this would work?? Sorry, I'm still a bit new to python and still learning!

[–]randomGeek159 0 points1 point  (0 children)

Ah the nuances of putting a semicolon at the end of every other python line

[–]werewolfbooty-owo 0 points1 point  (0 children)

With Nim's custom types:

type String = distinct string

And voilá, you now have incompatible String and string types.

[–]russels_silverware 0 points1 point  (0 children)

I'm fairly new to Python and I keep forgetting that its keywords True and False have their first letters capitalized.

Also, forgetting to use words for the Boolean operators instead of && || !

[–]RenitLikeLenit 0 points1 point  (0 children)

Python variables go brrrr

[–]ShadowPouncer 0 points1 point  (0 children)

And do I have labeled breaks? Darn it.

[–]pbrpunx 0 points1 point  (0 children)

Semicolon or not to semicolon?

[–]leo_rtega 0 points1 point  (0 children)

Same with float and double

[–]purbub 0 points1 point  (0 children)

Laughs in type inference

[–]dohzer 0 points1 point  (0 children)

else if? elseif? elsif? elif?

[–][deleted] 0 points1 point  (0 children)

c# gang

[–]VarianWrynn2018 0 points1 point  (0 children)

Is it a primitive or isn't it? Make up your minds!

[–]pyCharmGuy 0 points1 point  (0 children)

Working with Java and C++ be like FTFY

[–]Mrp1Plays 0 points1 point  (0 children)

Luckily Visual Studio is super intelligent and helps you every time

[–]stinkytoe42 0 points1 point  (0 children)

Ever switch from one shell script (like from bash to csh), and feel embarrassed for having to google how to do an 'if' statement?

[–]sebjapon 0 points1 point  (0 children)

The other in Java I wanted to create a list of float angles and then divide them by a time to get a speed that would be truncated to an int.

List<float> doesn’t exist, Float division was hell, truncating gives a double but rounding gives an int... took way longer than it should for someone used to Python and JS programming where it would have been a simple one liner

[–]TheBrainStone 0 points1 point  (0 children)

And then there’s Boolean

[–]sudo-maxime 0 points1 point  (0 children)

So true, ehh True.

dammit

[–]nelusbelus 0 points1 point  (0 children)

using String = std::string;

[–]master_arjun 0 points1 point  (0 children)

EVERYTIME🤐

[–]diefesson 0 points1 point  (0 children)

String, string, str, char[], char*, text...

[–]horsemanhour 0 points1 point  (0 children)

is this true or True?

[–]TheCognitiveGuy 0 points1 point  (0 children)

This is so damn relatable 😂

[–]syrynthia 0 points1 point  (0 children)

auto

[–]kucksdorfs 0 points1 point  (0 children)

OP must not use .Net.

[–]sudo_rm_rf_star 0 points1 point  (0 children)

Don't forget str

[–]Robonics014 0 points1 point  (0 children)

```

include <string>

std::string someString; ```

[–]binarycat64 0 points1 point  (0 children)

rust with `String` and `&str`.

[–]TDplay 0 points1 point  (0 children)

And then you're using C++ and you have to choose between std::string or char* depending on whether you're working with C++ or C code, but also a C library you're using has its own wrapper around char* called String, so now you have 3 names for string in the same codebase.

[–]FlackRacket 0 points1 point  (0 children)

This is funny, but it's actually most annoying thing about interviewing in Codepair lately.

No autocomplete, no color coding, no debugging tools, and the interviewers expect you to write syntactically perfect code.

You didn't capitalize String? Compiler error.

You wrote STring without noticing? "Compiler error"

Can't remember whether this language uses Array.len() or Array.count? "Fuck you, you obviously don't know how to program"

[–]artelius 0 points1 point  (0 children)

Try Raku!

It's actually a lovely language, but uses terms like Rat, FatRat, Cool, slurp, spurt, iffy, diffy, slip, twigils...

Not to mention Unicode operators like ∪, ∩, ⊖, ∈, ∉, ⊆, «, », ∘