The only way one should code C btw.

572 points · 80 comments · view on lemmy.world

80 Comments

Semi_Hemi_Demigod@lemmy.world · 72 pts · 305d (6 replies)

If you think German C is bad imagine Czech PHP.

Had to refactor an entire custom Magento plugin written in it.

ChaoticNeutralCzech@feddit.org · 54 pts · 304d (3 replies)

I found a random PHP file online and recreated your trauma:

<?phpcz
jmennýprostor Itb;


třída OvladačUživatele
{
    soukromá §větev;

    veřejná funkce akcePřihlašovacíhoFormuláře()
    {
        §poleParametrů = [
            'názevStránky' => 'Přihlašovací formulář',
        ];
        §vzor = 'domov.html.větev';

        §html = §toto->větev->vykresli(§vzor, §poleParametrů);
        vypiš §html;
    }


    veřejná funkce zpracujPřihlašovacíAkci(§uživatelskéJméno, §heslo)
    {
        když(§toto->platnéÚdajeSprávce(§uživatelskéJméno, §heslo)) {
            §_SEZENÍ['uživatelskéJméno'] = §uživatelskéJméno;
            §poleParametrů = [
                'názevStránky' => 'Vzorový formulář',
            ];
            §vzor = 'domov.html.větev';

            §html = §toto->větev->vykresli(§vzor, §poleParametrů);
            vypiš §html;
        } jinak {
            §poleParametrů = [
                'názevStránky' => 'Formulář chyby přihlašování',
            ];
            §vzor = 'chybaPřihlášení.html.větev';

            §html = §toto->větev->vykresli(§vzor, §poleParametrů);
            vypiš §html;
        }
    }

    soukromá funkce platnéÚdajeSprávce(§j, §h)
    {
        když('admin' == §j && 'admin' == §h){
            vrať pravda;
        }
        jinak když('staff' == §j && 'staff' == §h){
            vrať pravda;
        } jinak {
            vrať nepravda;
        }
    }

    veřejná funkce jePřihlášen()
    {
        když(jenastaveno(§_SEZENÍ['uživatelskéJméno'])){
            vrať pravda;
        } jinak {
            vrať nepravda;
        }
    }

    veřejná funkce uživatelskéJménoZSezení()
    {
        když(jenastaveno(§_SEZENÍ['uživatelskéJméno'])){
            vrať §_SEZENÍ['uživatelskéJméno'];
        } jinak {
            vrať '';
        }
    }

}

Is this what it looked like? (I also took the liberty of replacing $ with § because of the Czech keyboard layout; FYI: yes we do have a $ available as AltGr+ů but § is in the base layer; I would also replace the backtick/grève `, which is obtained by pressing AltGr+š once or twice (OS-dependent), with °).

Edit: BTW my first code was in the "Imagine" program, a Logo IDE with Czech localization (including syntax: do, vz, vp, vl, puntík, smaž, domů, příkaz, konec, piš etc.). The documentation was piss-poor, I never learnt if it had arrays or code comments. The textbook I had didn't even mention variables, I only learned about them in a short PDF guide I found online. Before that, I would use pixels on the canvas as variables.

Had my 10yo self received a Python runtime instead, I wouldn't be stimied by the "you don't need to pass arguments if every variable is global" mindset I'm still struggling to overcome. I found programming challenges online and was able to solve most theoretical ones, but Imagine was too limited to implement all but the basic practical ones, not to mention that it ran way slower than Python would. I was convinced that the lack of speed was mostly the hardware's fault and that I would need a low-level language like C++ to solve the 1000×1000 inputs in some puzzles. I got in touch with the challenge authors and they suggested Eclipse but I couldn't get it to work. I was too overwhelmed by the English interface and documentation and barely knew what a compiler was. I learnt decent English soon after but the fear of IDEs stayed, and eventually I turned towards electronics instead.

Semi_Hemi_Demigod@lemmy.world · 28 pts · 304d (2 replies)

Thanks now I’m having flashbacks

ChaoticNeutralCzech@feddit.org · 11 pts · 304d (1 reply)

Wow, I just learnt from your comment history that you likely don't even speak Czech. This must have been hell.

By the way, English not being my first language is one of the factors why I'm not a programmer, see the edit to the above comment.

Semi_Hemi_Demigod@lemmy.world · 9 pts · 304d

Just needed a little bit of patience and a whole lotta Google Translate

genfood@feddit.org · 14 pts · 304d

There is something like this? 😂

waigl@lemmy.world · 6 pts · 304d

Well, in PHP you cannot #define new words from some new language to mean basic language keywords.

argh_another_username@lemmy.ca · 36 pts · 304d (6 replies)

I worked with one of the authors of the Brazilian SQL. It was exactly what it looks, every reserved word translated to Brazilian Portuguese.

ByteJunk@lemmy.world · 10 pts · 304d (3 replies)

Oh god. I still have nightmares about that time I had excel formulas in Portuguese, I refuse to think about SQL.

eager_eagle@lemmy.world · 6 pts · 304d (2 replies)

Don't forget the keyboard shortcuts. Office products would change shortcuts according to the language, so it would be more mnemonic. Ctrl-F for find and Ctrl-B for bold would be reassigned to whatever initials that language had. Fun! /s

Hudell@lemmy.dbzer0.com · 4 pts · 304d

Not even the right initials. Most of the actions' names had the same few initials so they had to find synonyms to use the shortcut for. Search was Ctrl+L (from Locate). In other cases they just used whatever letter was next on the keyboard to the initial that was already in use.

SkunkWorkz@lemmy.world · 2 pts · 303d

Man I’m glad Dutch keyboards are just US international. So all the shortcuts are just the same as the English version. So I never had to unlearn localized shortcuts.

fibojoly@sh.itjust.works · 4 pts · 304d (1 reply)

Oh shit, I'd never get anything done, as I'd imagine my lovely friend's accent reading this shit out. Selecione * de tbl_minha-tabela onde nome não é nulo Hahaha! I love it!

argh_another_username@lemmy.ca · 2 pts · 304d

That reminds me, I had to modify a program written in VB once. The guy who created it wrote every table, every column, every view in Portuguese, WITH ACCENTS! It works, we simply have to put everything between brackets, but it doesn’t add anything to clarity. It looks awful and seems pedantic.

some_random_nick@lemmy.world · 28 pts · 304d (8 replies)

Grrman C might be fake, but German Excel isn't.

fibojoly@sh.itjust.works · 28 pts · 304d (6 replies)

Localised Excel formulas makes me so angry, it's hard to put it into words.

Kolanaki@pawb.social · 18 pts · 304d (2 replies)

it's hard to put it into words.

Just copy from Excel, then paste into Word. 🤷‍♂️

Rooster326@programming.dev · 6 pts · 304d (1 reply)

That's the problem. It's not called Word in other countries!

Appoxo@lemmy.dbzer0.com · 3 pts · 304d

Word, yo!

rucksack@feddit.org · 7 pts · 304d (2 replies)

Commas as a decimal separator be like: Guten Tag

luciferofastora@feddit.org · 5 pts · 303d

And the commas between function arguments in formulas become Semicola instead

fibojoly@sh.itjust.works · 2 pts · 304d

Bonjour!

Valmond@lemmy.world · 8 pts · 304d

I remember a bug where the PC at an electrical substation was in french, so 'if' had to be changed to 'si' in the excel sheet ...

palordrolap@fedia.io · 21 pts · 304d (9 replies)

Pretty sure druckef should be drucked. printf means print (to) file. "File" is valid German, but it is non-standard and "Datei" seems to be the preferred form.

I could also argue that that d should be capitalised, but I'm already overstepping my bounds considering I know very little German.

I wouldn't want to say which should take precedence between C's preference for all-lowercase keywords and functions and German's Rule to capitalise all Nouns.

Kwdg@discuss.tchncs.de · 23 pts · 304d

I think druckef is correct, the f means format. fprintf would b ddruckef or DdruckeF

e8d79@discuss.tchncs.de · 22 pts · 304d

Are you sure the f is supposed to mean file and not format, as in print a formatted string?

Grtz78@feddit.org · 5 pts · 304d

Blödsinn. Richtig heißt das "druckefuck".

belastend@lemmy.dbzer0.com · 0 pts · 304d (5 replies)

Du hast vollkommen Recht :)

trxxruraxvr@lemmy.world · 10 pts · 304d (4 replies)

Nee, de f in printf staat voor format, niet voor file.

schnurrito@discuss.tchncs.de · 10 pts · 304d (3 replies)

nederlands ees nur duits met veelen dooppelbuuchstaaben, ooder?

Lumidaub@feddit.org · 8 pts · 304d

Thaat's beecaauusee aafteer eenoouugh Schnaaps yoouu seeee doouublee. #DuutchIisDruunkGeermaan

trxxruraxvr@lemmy.world · 4 pts · 304d

Wir nutzen Doppelvokalen anstelle von der Umlaut und die Kasus sind nicht so kompliziert.

yetAnotherUser@discuss.tchncs.de · 3 pts · 304d

*dooppelvookaalen

peoplebeproblems@midwest.social · 17 pts · 304d (5 replies)

The concept of foreign languages in code confuses and frightens me

lauha@lemmy.world · 27 pts · 304d

But all programming language already are in a foreign language to most people.

Revan343@lemmy.ca · 15 pts · 304d (1 reply)

There's also rost

kamen@lemmy.world · 3 pts · 304d

Wow, that's cursed.

Yaky@slrpnk.net · 14 pts · 304d

Why? Programming language isn't a natural language. In fact, I think not knowing English makes it easier, since you cannot attach any preconceived notions, assumptions, or word order to keywords. I learned some Pascal, Visual Basic and whatever GameMaker used at the time without being fluent in English.

MrScottyTay@sh.itjust.works · 3 pts · 304d

Foreign? For some these languages are native. Foreign is relative.

(I'm just being pedantic, i understand that relatively to you - and me - this is foreign)

kickeriekuh@discuss.tchncs.de · 17 pts · 304d (3 replies)

Well, you can Code in a real German syntax: https://ddp.im/en/

A_norny_mousse@feddit.org · 13 pts · 304d (2 replies)

DDP has the following data types: Zahl (long), Kommazahl (double), Buchstabe (char), Text (string), Wahrheitswert (bool) und Listen (list)

Gottimhimmel, that would drive me crazy, and I'm German.

The code screenshot is pretty nice though. Actual grammar in there, full sentences that "Goethe would be proud of".

elvith@feddit.org · 3 pts · 304d

The code screenshot is pretty nice though. Actual grammar in there, full sentences that "Goethe would be proud of".

The syntax and all these Wenn reminds me of Cucumber/Gherkin

Opisek@piefed.blahaj.zone · 2 pts · 304d

Why yes I always dreamed of writing code like a full on novel.

dejected_warp_core@lemmy.world · 16 pts · 304d (10 replies)

I'm all in favor of zuruck replacing return, because that just sounds cooler. Plus z doesn't get enough use in my programs these days.

d_k_bo@feddit.org · 5 pts · 304d (8 replies)

*zurück

Do C compilers support non-ascii characters?

Appoxo@lemmy.dbzer0.com · 1 pts · 304d (7 replies)

Do as most non-DACH countries do: Just use the regular letter instead of the Umlaut.

Example:
Über-Mensch -> Uber-Mensch

d_k_bo@feddit.org · 7 pts · 304d (4 replies)

Just use the regular letter instead of the Umlaut

But that's just wrong. ü has a different meaning and pronunciation than u.

If umlauts aren't available, the correct way to write umlauts is with an additional e: zurueck.

Über-Mensch -> Uber-Mensch

Please be aware that this term can be problematic, since it can be seen as a foundation for fascist ideas. https://en.wikipedia.org/wiki/%C3%9Cbermensch#Use_by_the_Nazis

vaionko@sopuli.xyz · 1 pts · 303d (2 replies)

This makes it horrible to read. An example that comes to mind is a Finnish athlete with the last name Määttä. If it was Maatta, it would be pronounced differently but still understandable if you knew the person. But it was translated into Maeaettae which is just horrible

Haaveilija@lemmy.world · 1 pts · 303d

Also "Maatta" is a different word in Finnish with its own meaning: "without a country" or "without a land", while "Määttä" does not have this meaning. I agree that the aeae makes it horrible to read, though. Another athlete whose name has some ä's that make the it difficult to read when turned into ae's is Mäkäräinen which then becomes Maekaeraeinen :D

siipale@sopuli.xyz · 1 pts · 284d

Finnish doesn't have umlauts. Characters ä and ö are entirely different and separate from a and o so it doesn't make sense to add the letter e signifying a-umlaut or o-umlaut when writing in Finnish. German has umlauts so it makes sense to write either ä or ae when writing in German.

I agree it's best to write Maatta if letter ä is not available. I suppose the vocal harmony makes it easy to distinguish whether a is supposed to be a or ä and if o is supposed to be o or ö.

Appoxo@lemmy.dbzer0.com · 0 pts · 303d

Didnt have a better and fitting example

luciferofastora@feddit.org · 2 pts · 303d (1 reply)

If you replace the ü in "Das Wetter ist schwül" ("the weather is humid") with a u though, you get "the weather is gay".

Appoxo@lemmy.dbzer0.com · 1 pts · 303d

Never said it's a good substitute 🤷

MrScottyTay@sh.itjust.works · 2 pts · 304d

I often use z as a temp variable when i need something to compare to when creating new code but don't want a separate window to the side or to experiment with something but don't yet know what the result can or will be. I use z purely just because i know z is very very unlikely to have been used elsewhere, and if for some reason it has, then i just name it 'zz'.

This is actually temporary by the way. It does not stay in my code. Once I'm done with it, i delete it.

RavuAlHemio@lemmy.world · 15 pts · 304d

You are missing the Neuzeil at the end of the Schnur.

TheMightyCat@ani.social · 11 pts · 304d (2 replies)

Forget that the real evil is that the first character of Int or Ganz in this case is capitalized

lugal@lemmy.dbzer0.com · 14 pts · 304d (1 reply)

German has a word for it: Substantivgroßschreibung

Opisek@piefed.blahaj.zone · 2 pts · 304d

Quellcodeanglizismussubstastivbeispielersatzgroßschreibungsregel

eigenraum@discuss.tchncs.de · 9 pts · 304d (1 reply)

Ich will das! 😍 Zurück 0;

MonkderVierte@lemmy.zip · 1 pts · 304d

Versuche, fangen, aus.

A_norny_mousse@feddit.org · 9 pts · 304d (7 replies)
#beinhalte

My German teacher: any usage of the verb 🦵-halten in your essay is a point off.

zurück 0;
Opisek@piefed.blahaj.zone · 2 pts · 304d (6 replies)

What's wrong with beinhalten?

Lumidaub@feddit.org · 7 pts · 304d (2 replies)

Handhalten is more romantic.

hakunawazo@lemmy.world · 3 pts · 304d (1 reply)

The romantic version would be händchenhalten. Handhalten sounds efficiently German, but not romantic.

Lumidaub@feddit.org · 3 pts · 304d

But that ruins the joke! You Germans and your utter and complete lack of a sense of humour, sheesh.

schnurrito@discuss.tchncs.de · 4 pts · 304d

It doesn't fit very well in this context, the idea behind "beinhalten" is that the subject "includes" the object (i.e. the object is part of the content of the subject), but the #include command in the C preprocessor isn't about describing that kind of situation, it's a command "I want to include one file in another", a better verb in German for that is "einbinden". (I realize this isn't a very good explanation, but I'm a native speaker of German and can tell you that no one would use the verb "beinhalten" in this context.)

The previous commenter's German teacher likely prefers "enthalten" instead of "beinhalten", which has the same problem in this context though.

A_norny_mousse@feddit.org · 3 pts · 304d

Overuse and lack of elegance, in her opinion.

We still loved her though.

ornery_chemist@mander.xyz · 2 pts · 304d

Maybe incorrect rebracketing? It's supposed to be be-inhalten, not bein-halten. Otherwise maybe a writing style thing...

dick_fineman@discuss.online · 8 pts · 303d (4 replies)

I prefer to code by yelling at Chat GPT, copy-pasting to Grok, telling Grok Chat GPT said it couldn't write cleaner code, then going back and forth between the 2 with fake insults from the other until one declares a Jihad on the other. I think it's called "vibe coding".

LustyArgonianMana@lemmy.world · 5 pts · 303d (3 replies)

Yes, I want my code with a side of deforestation

Alaknar@sopuli.xyz · 2 pts · 303d (1 reply)

Just think about it - the more deforested areas, the more room for data centres and power plants! It's literally a win-win!

LustyArgonianMana@lemmy.world · -4 pts · 303d

The whole earth covered with warm, unliving metal as a tribute to the earth's core

Unrelated Image for fun, Blessed Are the Meek

dick_fineman@discuss.online · 2 pts · 303d

Silly librul, everyone knows forests are a lie sold to us by big-pharma so they can sell us more vaccines. That's why I take my Ivermectin enemas daily, and you should too! It helps you see through the Jewish Space Lasers!

30p87@feddit.org · 5 pts · 304d (3 replies)

Most fucked up thing here is

<type> <name>
{
boonhet@sopuli.xyz · 6 pts · 304d

I must be old because I remember that as being the standard form until Java popularized

<visibility> <static?> <type> <name> {

I mean I'm not that old, but I was reading more C and C++ books and tutorials when I was a kid, because "ew Java"

yetAnotherUser@discuss.tchncs.de · 3 pts · 304d (1 reply)

Das ist K&R C, du Banause!

30p87@feddit.org · 2 pts · 303d

Ich verklage Brian Kernighan und Dennis Ritchie auf Schmerzensgeld.

vrighter@discuss.tchncs.de · 4 pts · 303d

you need to compile c with a c++ compiler to be able to define macros for keywords iirc. But I did do this once to translate c to my native language, Maltese. It was cursed

paequ2@lemmy.today · 4 pts · 304d

has entered the chat

WanderingThoughts@europe.pub · 3 pts · 304d

Flashbacks to programming a Siemens PLC. That was on a "portable" PG with a CRT screen.