this post was submitted on 21 Nov 2025
134 points (97.9% liked)

196

4858 readers
1025 users here now

Community Rules

You must post before you leave

Be nice. Assume others have good intent (within reason).

Block or ignore posts, comments, and users that irritate you in some way rather than engaging. Report if they are actually breaking community rules.

Use content warnings and/or mark as NSFW when appropriate. Most posts with content warnings likely need to be marked NSFW.

Most 196 posts are memes, shitposts, cute images, or even just recent things that happened, etc. There is no real theme, but try to avoid posts that are very inflammatory, offensive, very low quality, or very "off topic".

Bigotry is not allowed, this includes (but is not limited to): Homophobia, Transphobia, Racism, Sexism, Abelism, Classism, or discrimination based on things like Ethnicity, Nationality, Language, or Religion.

Avoid shilling for corporations, posting advertisements, or promoting exploitation of workers.

Proselytization, support, or defense of authoritarianism is not welcome. This includes but is not limited to: imperialism, nationalism, genocide denial, ethnic or racial supremacy, fascism, Nazism, Marxism-Leninism, Maoism, etc.

Avoid AI generated content.

Avoid misinformation.

Avoid incomprehensible posts.

No threats or personal attacks.

No spam.

Moderator Guidelines

Moderator Guidelines

  • Don’t be mean to users. Be gentle or neutral.
  • Most moderator actions which have a modlog message should include your username.
  • When in doubt about whether or not a user is problematic, send them a DM.
  • Don’t waste time debating/arguing with problematic users.
  • Assume the best, but don’t tolerate sealioning/just asking questions/concern trolling.
  • Ask another mod to take over cases you struggle with, if you get tired, or when things get personal.
  • Ask the other mods for advice when things get complicated.
  • Share everything you do in the mod matrix, both so several mods aren't unknowingly handling the same issues, but also so you can receive feedback on what you intend to do.
  • Don't rush mod actions. If a case doesn't need to be handled right away, consider taking a short break before getting to it. This is to say, cool down and make room for feedback.
  • Don’t perform too much moderation in the comments, except if you want a verdict to be public or to ask people to dial a convo down/stop. Single comment warnings are okay.
  • Send users concise DMs about verdicts about them, such as bans etc, except in cases where it is clear we don’t want them at all, such as obvious transphobes. No need to notify someone they haven’t been banned of course.
  • Explain to a user why their behavior is problematic and how it is distressing others rather than engage with whatever they are saying. Ask them to avoid this in the future and send them packing if they do not comply.
  • First warn users, then temp ban them, then finally perma ban them when they break the rules or act inappropriately. Skip steps if necessary.
  • Use neutral statements like “this statement can be considered transphobic” rather than “you are being transphobic”.
  • No large decisions or actions without community input (polls or meta posts f.ex.).
  • Large internal decisions (such as ousting a mod) might require a vote, needing more than 50% of the votes to pass. Also consider asking the community for feedback.
  • Remember you are a voluntary moderator. You don’t get paid. Take a break when you need one. Perhaps ask another moderator to step in if necessary.

founded 10 months ago
MODERATORS
 
top 29 comments
sorted by: hot top controversial new old
[–] sunoc@sh.itjust.works 71 points 5 days ago (2 children)

You can't perform calculations on a string

Laugh in C

[–] JusticeForPorygon@lemmy.blahaj.zone 34 points 5 days ago (1 children)
[–] sunoc@sh.itjust.works 32 points 5 days ago (1 children)

You mean arrays of chars ?

[–] Atlusb@lemmy.world 11 points 5 days ago (1 children)

What about a pointer to a series of pointers which point to chars?

NASA's 11th rule: All forms of indirection must indirect 12 times. This is not an upper or lower bound. This is the exact number of indirections. Why? F*** you, that's why.

[–] anton@lemmy.blahaj.zone 9 points 5 days ago
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

char* addStrings(char* as, char*bs){
        int aL=strlen(as);
        int bL=strlen(bs);
        if (aL<bL){
                char* temp=bs;
                int tL=bL;
                bs=as;
                bL=aL;
                as=temp;
                aL=tL;
        }
        char* cs = malloc(aL+2);
        cs[aL+1]='\0';
        bool carry = false;
        int bi=bL-1;
        for(int ai=aL-1; ai>=0; ai--,bi--){
                char a=as[ai];
                char b='0';
                if(bi>=0)b=bs[bi];
                char c=a+b-'0';
                if(carry)c++;
                carry=c>'9';
                if(carry)c-=10;
                cs[ai+1]=c;
        }
        if(carry) cs[0]='1';
        else cs[0]='0';
        return cs;
}

int main(int argc, char**args){
        printf("%s + %s = %s\n", args[1] , args[2] , addStrings(args[1] , args[2]));
}
[–] renzhexiangjiao@piefed.blahaj.zone 58 points 5 days ago (1 children)

In computing, whole numbers are referred to as integers

they are known as integers outside of computing too lol

[–] pory@lemmy.world 11 points 4 days ago

Yeah, but in computing (well, specifically the language this slide is about) they're referred to as integers and not referred to as "whole numbers" or any other synonym. If you're looking up something to do with integers in the documentation, you need to have the word "integer" in your vocabulary as "the" way to refer to numbers without decimal places to find what you're looking for. Same way you need to know "string" instead of "word" or "text field" or "sentence".

[–] AI_toothbrush@lemmy.zip 8 points 3 days ago

You can very much perform calculations on strings, and its a very cool thing, but i think thats wayyy above the level that this presentation is meant for cause you probably should know what integers are before that, even outside of programming...

[–] zqwzzle@lemmy.ca 49 points 5 days ago (1 children)

JavaScript trying to look nonchalant in the corner.

[–] orockwell@lemmy.world 8 points 5 days ago (1 children)
[–] jia_tan@lemmy.blahaj.zone 17 points 5 days ago (1 children)
[–] genuineparts@sh.itjust.works 25 points 5 days ago (1 children)

Amazingly you can store all sorts of things in variables.

[–] ThunderComplex@lemmy.today 14 points 5 days ago (2 children)

Including nothing. Actually, depending on the language, multiple types of nothing (null vs uninitialized)

actually, you can even store pointers to nothing in memory. you just do:

void x;
void* x_ptr = &x;

then you can use it to invoke functions that take no arguments like this:

void open_texteditor (void editor_choice)
{
    // do nothing with the editor_choice because there is only one sensible editor
    open_nano(); 
    return void;
}
void favorite_texteditor;
void result = open_texteditor(favorite_texteditor);
print_error_on_bad_result(result);

(note that this is a joke comment)

[–] ICastFist@programming.dev 6 points 4 days ago

This has made a lot of people very angry and been widely regarded as a bad move.

[–] ArtVandelay@lemmy.world 4 points 3 days ago

"preform calculations"

[–] dandelion@lemmy.blahaj.zone 23 points 5 days ago

comp sci brainrot

[–] sp3ctr4l@lemmy.dbzer0.com 19 points 5 days ago (1 children)

I mean, in Python, Int() literally is a pre - formed function for per - forming math on strings.

[–] rumschlumpel@feddit.org 17 points 5 days ago* (last edited 5 days ago) (1 children)

IIRC int() doesn't let you do math on strings, it converts strings into integers and then you can do math with those numbers.

[–] sp3ctr4l@lemmy.dbzer0.com 1 points 5 days ago* (last edited 5 days ago)

Yes. It converts ... well, any data type, really, to an int, and then you can do math on that value, via the normal Python syntax.

My point was that Int() is pre - formed... the author of this slide here is hopefully, before they switch to the next side, asking the classroom if there is anything wrong with their slide.

Small spelling errors are often trvial in written language, but uh... they're kind of a very big deal in code.


You... could make a function that directly does some math operations on a string.

You could try to set up a bitshifting scheme, you could essentially make FancyMathInt(x,y), where x is converted to an int, and, perhaps hilariously, y is a string of math operations done to x, after y itself is parsed and converted to an instruction set...

There's a lot of ways you could do that.

... Most of them are probably stupid, but, niche edges do sometimes arise where something like that could be useful.

[–] Treczoks@lemmy.world 11 points 5 days ago (1 children)

This is programming 101 from which century?

[–] spujb@lemmy.cafe 1 points 5 days ago (1 children)

does it say programming 101 somewhere

[–] Rooster326@programming.dev 2 points 4 days ago (1 children)

No programming 101 is what happens when you perform calculations on a string.

Please do try to keep up.

[–] spujb@lemmy.cafe 0 points 4 days ago* (last edited 4 days ago) (1 children)

oh i see we are just being judgmental for fun my fault for assuming it was genuine :(

[–] Rooster326@programming.dev 3 points 4 days ago* (last edited 4 days ago)

It is only a joke.

Calculations on strings are "allowed".

"10" + "1" = "101"

[–] AnUnusualRelic@lemmy.world 3 points 4 days ago (1 children)

Is it all right to postform calculations on a string?

[–] TootSweet@lemmy.world 2 points 4 days ago

I can't let you do that, Dave.