Coding in China be like

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024

Комментарии • 942

  • @appeiroon
    @appeiroon 2 года назад +12483

    The joke is that the program is asking for input, but in China public's opinion is not allowed.

    • @JaishyamRB
      @JaishyamRB 2 года назад +693

      This also makes sense, but scanf function is generally unsafe as it may cause stack buffer overflow vulnerability

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz 2 года назад +77

      I wrote the exact same comment but somehow yours escaped me. Honestly this is funnier to me 🤣

    • @CentralProcessingUnitCore
      @CentralProcessingUnitCore 2 года назад +29

      Oh ok, I only rly code in python and java and a bit of c++

    • @poofj7916
      @poofj7916 2 года назад +15

      thats alao untrue

    • @laur-unstagenameactuallyca1587
      @laur-unstagenameactuallyca1587 2 года назад +17

      that's not the joke but that's a funny take on it

  • @joaogarcia6170
    @joaogarcia6170 2 года назад +2074

    Started my CS major last year, teacher wouldn't shut up about scanf the entire semester, so this is what his classes felt like.

    • @nolanfaught6974
      @nolanfaught6974 2 года назад +100

      Okay but it's easy to avoid buffer overflows with scanf if your format specifier gives a maximum length. Regardless, you should be taught to read raw data, SANITIZE YOUR INPUTS, and then parse with `sscanf` and use proper return values. scanf is incredibly fast and powerful when used properly, not like that clunky cin/cout business with c++

    • @marceldabrowskii
      @marceldabrowskii 2 года назад +1

      i love this comment

    • @stevefan8283
      @stevefan8283 2 года назад +7

      why use scanf when you have std::cin

    • @jianghan4086
      @jianghan4086 2 года назад +69

      Because this is C, not C++

    • @nwah816
      @nwah816 2 года назад +31

      @@stevefan8283 Because coding in c++ is a sin

  • @minoroyale1226
    @minoroyale1226 2 года назад +6161

    I'll save this video. Go learn C and comeback to get it.
    Edit : i end up learning python

    • @SENTRY456123
      @SENTRY456123  2 года назад +689

      Googling "scanf unsafe" will probably help you a lot.

    • @wmpowell8
      @wmpowell8 2 года назад +185

      I tried to use scanf once and my compiler, Clang, warned me that it was deprecated and unsafe.
      If you're ever working with buffers in C, make sure you check to make sure the stuff that you put in the buffer isn't bigger than the buffer itself in order to avoid a buffer overflow exploit.
      Also be wary of buffer underflow exploits; this is a good case because C strings are null-terminated. If the stuff you're copying has length mismatches, don't even bother with it due to buffer over/underflow exploits.

    • @BSPNode
      @BSPNode 2 года назад +17

      @@wmpowell8 I don't know if I should do this, but I create a buffer of a fixed amount, and use fgets to read from "stdin". Then I just parse the buffer for the data I actually want.

    • @geto6242
      @geto6242 2 года назад +5

      @@BSPNode I do the same thing! That's definitely safe

    • @Someone-ve7yn
      @Someone-ve7yn 2 года назад +7

      @@SENTRY456123 Scanf is unsecure with strings because it has no fixed length

  • @VivekYadav-ds8oz
    @VivekYadav-ds8oz 2 года назад +7169

    I thought the negative social credits were because you asked for user's opinions rather than hard-coding the government's.

    • @Manu-se5tx
      @Manu-se5tx 2 года назад +156

      Though so too and honestly this version is funnier

    • @hashtags_YT
      @hashtags_YT 2 года назад +24

      @@Manu-se5tx Even online I still have no idea what "this" refers to...

    • @Manu-se5tx
      @Manu-se5tx 2 года назад +8

      @@hashtags_YT OP's version

    • @w1z4rd9
      @w1z4rd9 2 года назад +7

      My stupid ass technically thought that was the reason.

    • @different_stuff
      @different_stuff 2 года назад +4

      government is the user as well

  • @cat-.-
    @cat-.- 2 года назад +1157

    It is rumored that when you divide 6 by 4 with '/' operator you will be invited to the local police station for tea

    • @heroes-of-balkan
      @heroes-of-balkan 2 года назад +37

      Jokes aside, why?

    • @yeaboi3593
      @yeaboi3593 2 года назад +246

      Date of the Tianmen square massacre

    • @davidugono3727
      @davidugono3727 2 года назад +189

      @@yeaboi3593 -999,999,999,999 SOCIAL CREDIT!!!

    • @izergaer
      @izergaer 2 года назад +103

      @@yeaboi3593 nothing happened in Tiananmen Square

    • @yeaboi3593
      @yeaboi3593 2 года назад +9

      @@davidugono3727 nooooooo

  • @Rsparing
    @Rsparing Год назад +496

    The Actual reason for the unsafe code is that when he put "scanf("%s", input); There was a chance that when the user put more than 9 characters (including the null symbol) that scanf could override some data in next to that point in memory and write your input on some critical information.
    He also asked for an opinion

    • @SomeRandomPiggo
      @SomeRandomPiggo Год назад +9

      I think the OS stops that from happening and kills it with a segmentation fault

    • @lex-ch3xv
      @lex-ch3xv Год назад +36

      ​@@SomeRandomPiggo it only happens if input rewrites memory of other processes/programs. However, if it rewrites memory of only this process, you will deal with bugs and probably undefined behavior

    • @sfs8730
      @sfs8730 Год назад

      Fuck that sounds terrible

    • @budgetarms
      @budgetarms Год назад +5

      and write your input on some critical information is like a horrible way of explaining what is going on, if you are a programmer, I mean it is killing me.

    • @davidmovsisyan1280
      @davidmovsisyan1280 9 месяцев назад

      mayeb you can say more like disallowed memory location (e.g. due to lack of priviliges or just straight illegal) because it's not that easy to access other processes when they are all isolated by virtual memory technique. @@lex-ch3xv

  • @migueljara9399
    @migueljara9399 2 года назад +490

    We need a new ".ccp" file format

    • @thatchapthere
      @thatchapthere 2 года назад +115

      Ah yes, the CC+ language

    • @davidciprys7811
      @davidciprys7811 2 года назад +48

      +25 social credit

    • @suntzu1409
      @suntzu1409 2 года назад +36

      @@thatchapthere *CCP+ language
      -999999 social credit for you

    • @suntzu1409
      @suntzu1409 2 года назад +10

      Let me guess:
      Only CCP can write programs in this language

    • @winmen5279
      @winmen5279 Год назад +3

      @@suntzu1409 its CPC not CCP, -1/0 social credit for xenophobic act

  • @sprytnychomik
    @sprytnychomik 2 года назад +4138

    Just replace 'input' with '(char *)argv'. If there's not enough memory then at least it's not your fault.

    • @SENTRY456123
      @SENTRY456123  2 года назад +388

      Also, if you want to automate the program, using arguments instead of using scanf() is much more suitable.

    • @EvilSapphireR
      @EvilSapphireR 2 года назад +21

      You'd destroy the entire command line parameter array

    • @w花b
      @w花b 2 года назад +7

      @@shu3684 which stands for scanf secured amirite

    • @Snail5008
      @Snail5008 2 года назад +43

      @@shu3684 Nah, real programmers use gets.
      /s

    • @Marco-uo9ww
      @Marco-uo9ww 2 года назад +5

      This is so 5Head I can't believe it.

  • @futuristic-
    @futuristic- Год назад +467

    In China they don’t learn C. They learn A+

    • @clidlove
      @clidlove Год назад

      Are you sure?😅we don't learn c?😅

    • @clidlove
      @clidlove Год назад

      stereotype😅😅

    • @sjegannath6295
      @sjegannath6295 Год назад +58

      No they learn A++

    • @陸
      @陸 Год назад

      @@clidlove its a joke dumbass

    • @SmallLemonPRO
      @SmallLemonPRO Год назад +28

      Nah
      We learn 共产党+

  • @jpheitman1
    @jpheitman1 2 года назад +1149

    If you're ever coding date systems or anything that uses a calendar in China, just remember: June 3rd is immediately followed by June 5th. There is nothing in between.

    • @thegamingengine4537
      @thegamingengine4537 2 года назад +231

      Nothing happened on June 4th, 1989. I can confirm as I wasn’t there since nothing happened.

    • @aravindpadmanabham6385
      @aravindpadmanabham6385 2 года назад +20

      Yeah we ain't seen nothing

    • @lostzhengli1060
      @lostzhengli1060 2 года назад +5

      Huh no, im chinese

    • @jpheitman1
      @jpheitman1 2 года назад +1

      @@lostzhengli1060 金水桥

    • @CutieFakeKirby
      @CutieFakeKirby 2 года назад +41

      June 3 and June 5 are both 36 hours long, there is no June 4th

  • @mr.haiwan
    @mr.haiwan 2 года назад +191

    the code says: "Taiwan is a country"

    • @onichan6897
      @onichan6897 2 года назад +36

      social_credit -= 999999;

    • @moister3727
      @moister3727 2 года назад

      Social credit deducted
      Your execution will be in 2 hours

    • @Rubenz343
      @Rubenz343 2 года назад

      "WARNING: Your execution is scheduled for tomorrow at 8 am."

    • @呀咧呀咧
      @呀咧呀咧 Год назад +17

      Execution date: now

    • @sophiatheczech1918
      @sophiatheczech1918 Год назад

      @@onichan6897 execute(user);

  • @benjaminwaltermauss3349
    @benjaminwaltermauss3349 2 года назад +539

    For those do didn't understand, this code is vulnerable to stack/buffer overflow

    • @voicedrewxyz
      @voicedrewxyz 2 года назад +115

      My brother in christ I don't know what that means

    • @noarvd8236
      @noarvd8236 2 года назад +14

      In non coding language?

    • @whong09
      @whong09 2 года назад +209

      It means very bad wrongthink. You will be reeducated. A stack is what your cpu uses to store local variables (memory). In C the stack is only as big as you allocate (reserve...) - in this case 10 bytes. Scanf loads input data in this case onto the stack but there's no guarantee the input data is less than 10 bytes (10 characters), but C will happily write your extra data past the allocated stack memory thus causing all kinds of bad things to be possible ranging from your program crashing to you getting hacked.
      Like if you take your backpack and keep shoving shit in it it's going to rip and spill everything out. That's a stack overflow.

    • @dingel_91716
      @dingel_91716 2 года назад +9

      If that is a string so it must be has null at the last element automatically right? If that so , Will the bufferflow occurs when we type more than 9 characters or more than 10 characters?

    • @bravish
      @bravish 2 года назад +4

      Yh I remember my first c project I had to clear the buffer every couple lines cuz I was too lazy to rewrite any code.

  • @deletevil
    @deletevil 2 года назад +187

    This is why Chinese have the best quality Linux wifi drivers.

    • @captainvenom7252
      @captainvenom7252 2 года назад +1

      Including 802.11n

    • @suntzu1409
      @suntzu1409 2 года назад +3

      And highest quality of basically every kind of electronics you can imagine

    • @captainvenom7252
      @captainvenom7252 2 года назад

      @@suntzu1409 dude anyone can make better quality electronics but to claim a price is a game of import and export data

    • @razpaqhvh7501
      @razpaqhvh7501 2 года назад +8

      @@suntzu1409 a relative of mine is an embedded software developer and likes to tinker with electronics so naturally he had to go to shenzhen. What he said, is mind blowing to me. You can obtain a GTX 1080 (example) for 1/4 the price, because they make them and those are for the chinese market. They had some off brand processors that were really interesting spec wise, although I forgot their name it was something in chinese. I'm 100% sure they have 4000 RTX series there already, it's just that the western media block everything good about china and just spread propaganda how people in china live in mudhuts etc... Even though an average Chinese citizen is actually richer than an average USA citizen, now ofcourse, china's standard is lower and so are the salaries but it doesn't make a difference when you don't import only export.

    • @lostzhengli1060
      @lostzhengli1060 2 года назад

      @@razpaqhvh7501 THANK YOU FOR FINALLY SAYING THE TRUTH

  • @呀咧呀咧
    @呀咧呀咧 Год назад +5

    printf(“Zao shang hao! Wo you yi ge bing chilling”);

  • @pasijutaulietuviuesas9174
    @pasijutaulietuviuesas9174 2 года назад +195

    Redundant code in the description. -100 social credit.

    • @SENTRY456123
      @SENTRY456123  2 года назад +64

      Just execute the code, not me.

    • @suntzu1409
      @suntzu1409 2 года назад +10

      @@SENTRY456123
      Just execute the code?
      More -♾️♾️♾️♾️ social credit
      Your execution date is tommorow

    • @Φωτό-ρ7π
      @Φωτό-ρ7π Год назад

      @@SENTRY456123 captain philips has entered the chat: i know (evangelion ed lyrics)

  • @jopaslona1
    @jopaslona1 2 года назад +89

    As a programming student studying in China I can relate. Except we are coding in Dev-C++ in gcc 4.8

    • @juliangonzalez1207
      @juliangonzalez1207 2 года назад +9

      If I may ask, why are you using an old version of gcc? Here in my country when we use something outdated is because the University schedule hasn't been updated since it's creation but I thought that in China you would use the latest technology

    • @jopaslona1
      @jopaslona1 2 года назад +30

      @@juliangonzalez1207 I thought to myself that if I go to Chinese University that literraly launches robots to Mars and makes software for Olympic games I would be a great programmer and demanded specialist but the only thing I left with is studying C language using outdated software and tons of physics and chinese edition of electrical enginiring.

    • @jopaslona1
      @jopaslona1 2 года назад

      @@juliangonzalez1207 Chinese Universities has the same issue as yours. They just can't keep up with modern technologies that everyone use. And overall the technological progress in China is really overrated. Take a look at any chinese website. They really bring some 90-s vibes

    • @DeerJerky
      @DeerJerky 2 года назад

      @@jopaslona1 That sucks, good luck mate

    • @zuccburger7293
      @zuccburger7293 2 года назад

      @@jopaslona1 either your faculty is shit or the uni you go to is shit, may I ask which uni you went to?

  • @Nekhaevalex
    @Nekhaevalex Год назад +23

    After being a programmer for a few years, I got a new phobia: I'm afraid of pressing any buttons in GUI applications. When I see buttons, I make sure that any progress I made was saved at least 3 times, and when the button is pressed, I pray for the application not to fall, I pray for OS to overcome such a stressful process as handling function binded to that button and I feel totally happy when I see no BSODs on the screen after the button released.
    Why am I saying it in comments after this video? Cause if Chinese programs are really written this way, there is still a hope that this world's software can be usable

  • @alexwang007
    @alexwang007 2 года назад +33

    Not enough comments, *-5,000 social credits*

    • @Someone-ve7yn
      @Someone-ve7yn 2 года назад +1

      Non conventional main signature, *-1,000 social credits*

  • @LinkEX
    @LinkEX 2 года назад +94

    0:23 Does anyone know where those corny smileys came from that keep getting used ironically in memes?
    I do remember that they could be used in ICQ. Which makes them ancient by internet standards.

    • @Pumpkin-Link
      @Pumpkin-Link 2 года назад +4

      They look like those emoticon packs for MSN messenger that installed a virus in you PC

    • @suspicioussand
      @suspicioussand 7 месяцев назад +1

      I don't know but I'd like to, as well

  • @joshuaorthodox
    @joshuaorthodox Год назад +30

    Back after 10 months, thank you for getting me to learn C, it's my favourite language now :)

  • @SmallLemonPRO
    @SmallLemonPRO Год назад +11

    As a chinese which learning C++ I can confirm that if I don't return 0; , I'll get arrest

  • @623-x7b
    @623-x7b 2 года назад +37

    hint: scanf("%9s", string); // leave room for the null terminator.
    should use char input[10] = {0}

    • @korn6657
      @korn6657 2 года назад +3

      Bruh moment

    • @heroes-of-balkan
      @heroes-of-balkan 2 года назад

      Wouldn't that cause an error? How to put an integer to a character array?

    • @BSPNode
      @BSPNode 2 года назад +5

      @@heroes-of-balkan It's just initializing the array to the value of zero, which in ASCII is a null value.

    • @pyrodynamic4144
      @pyrodynamic4144 2 года назад +2

      @@heroes-of-balkan characters are numbers (in C). 1 byte numbers. They represent the ASCII code of the character but nothing is stopping you from using them like a regular number (not recommended). You can even perform arithmetic on them - 'a' + 1 is 'b'.

    • @heroes-of-balkan
      @heroes-of-balkan 2 года назад

      @@pyrodynamic4144 that is true, but 4 bytes in 1 element that can store 1 byte made me scratch my head

  • @aerglass9816
    @aerglass9816 2 года назад +66

    life is too short to be coding in china

    • @AByteofCode
      @AByteofCode 2 года назад +7

      *life is too short __because__ coding in china

    • @TheGeorey
      @TheGeorey 2 года назад

      you mean life gets short if you code in china

    • @suntzu1409
      @suntzu1409 2 года назад +9

      Life is too short because of living in china

  • @Zephyroths
    @Zephyroths 2 года назад +13

    using VS Code, social credit -1000000

    • @OneMilian
      @OneMilian Год назад

      Either church of emacs or cult of vim.
      i use evil-mode its the best of both. But everyone has their pref.

    • @DatBoi_TheGudBIAS
      @DatBoi_TheGudBIAS 7 месяцев назад

      Me using vs code cuz idgaf and just want a text editor with embedded terminal so I don't need 2 programs opened at once

  • @vivekpallikona8094
    @vivekpallikona8094 2 года назад +15

    I like how the video turned from a meme for entertainment to an educational content..

  • @Rundik
    @Rundik Год назад +2

    He did not thank the goverment for the opportunity. That was a first mistake. He also did not provide a backdoor for the secret service. Oh wait, he did

  • @ananttiwari1337
    @ananttiwari1337 2 года назад +33

    epitome of 21st century comedy

  • @tttttttttttttttttt0
    @tttttttttttttttttt0 2 месяца назад +2

    Fun fact: the “return 0” actually isn’t useless, it sets your social credit to 0

  • @KrispyKremesKubbler-sx7mz
    @KrispyKremesKubbler-sx7mz 6 месяцев назад +4

    i use this as music for studying

  • @aezravito9717
    @aezravito9717 3 месяца назад +2

    Very true
    Had my cousin work there and now he's gone.

  • @xpellidagoat
    @xpellidagoat Год назад +3

    im from china and the government authorities once showed up in my house because I tried to run a dangerous hello world program

  • @funnymanhaha8386
    @funnymanhaha8386 Год назад +4

    1. 事实胜于雄辩。 (Shìshí shèng yú xióngbiàn)
    - Facts beat eloquence.
    From Lu Xun's "Hot Wind" (鲁迅《热风题记》), it's like, "Actions speak louder than words."
    2. 一言既出,驷马难追。(Yìyán jì chū, sìmǎ nán zhuī / 'a word already produced, team-of-4-horses difficult chase')

  • @stevenhe3462
    @stevenhe3462 2 года назад +5

    Chinese programmers write comments in Chinese. Other than that…
    (You can use Chinese for variable and function names as well because they are unicode characters and does not include spaces)

  • @srgeyt
    @srgeyt Год назад +1

    why has this video been recommended to me so many times this week wtf...

  • @CalebHigginbotham
    @CalebHigginbotham 2 года назад +3

    The scream at the end: 🤣💀

  • @defi100nt9
    @defi100nt9 2 года назад +2

    I got a weird ad in Chinese before playing the video

  • @fhs9441
    @fhs9441 2 года назад +4

    Memory leak: -1000000 social credit

  • @MatheusKlSch
    @MatheusKlSch 2 года назад +128

    ah yes
    scanf
    controversial
    but the most dangerous thing is strings themselves, not scanf
    *meanwhile me reading thousands of lines from a file and parsing it's contents*

    • @dingel_91716
      @dingel_91716 2 года назад +2

      If that is a string so it must be has null at the last element automatically right? If that so , Will the bufferflow occurs when we type more than 9 characters or more than 10 characters?

    • @DatBoi_TheGudBIAS
      @DatBoi_TheGudBIAS 7 месяцев назад

      ​@dingel_91716 10. But if u write 10 chars, ur string wont be terminated and if u try to print it, ull get some trash characters from the next bytes in memory, till it hits a 0

  • @sleebu
    @sleebu 2 года назад +3

    I really thought he was gonna create *public* variables in class

  • @Palexite
    @Palexite 2 года назад +1

    this is definitely the entire matrix code of what happened in tiananmen Square. apsolutely nothing.

  • @이현규-b7i
    @이현규-b7i 2 года назад +7

    Is there no "#define _CRT_SECURE_NO_WARNINGS" in China? LOL

  • @yarik_superpro
    @yarik_superpro Год назад +3

    😇👍
    🇨🇳+ 15 social credits 📈

  • @ik2254
    @ik2254 2 года назад +54

    In China JavaScript is called TaiwanScript

  • @fluffsquirrel
    @fluffsquirrel Год назад +1

    Chef's kiss, Willy scream.

  • @JackieJKENVtuber
    @JackieJKENVtuber 2 года назад +5

    You've seen China's security, clearly no one would get executed for that

  • @RAZREXE
    @RAZREXE 2 года назад +40

    As someone who has never been to China, I can confirm this to be accurate

  • @realrazoblast
    @realrazoblast 2 года назад +3

    Oh well, I guess I have to use my power.
    **insecure*

  • @monder4703
    @monder4703 2 года назад +4

    I subscribed you only because of your description. Good Job lol

  • @insalatadipomodoro7824
    @insalatadipomodoro7824 2 года назад +12

    //DEBUG BE LIKE:
    class Person{
    private: ...
    ^
    Error: cannot use private property, -1000 Social Credit!

    • @dragonlordsaviour7005
      @dragonlordsaviour7005 2 года назад +1

      wait a second,properties are private by default in cpp. -1gazilllion social credits.

    • @insalatadipomodoro7824
      @insalatadipomodoro7824 2 года назад

      @@dragonlordsaviour7005 This is why the revolution had to take place, the world is capitalist by definition!!!!i!

  • @TheAbad1
    @TheAbad1 Год назад +1

    how did i know it was going to be this song before i clicked on the video

  • @GlitchedBlox
    @GlitchedBlox Год назад +2

    C, C++, C#. The language of the damned.

    • @OneMilian
      @OneMilian Год назад

      C is very cool. For me it only has upsides. Love lower level languages. But it goes down way deeper to. Like Assembly but here it becomes very hardware specific.
      But what is even more important is having the right tool for the right job.
      That can mean different things.
      example if you know many languages you can choose an language for the right task.
      But if you are a master in one language you can do most tasks with one language alone.
      remember if all you got is a hammer, all problems start to look like nails.

  • @reouneru_
    @reouneru_ 2 года назад +5

    this makes me laugh even when i only know python lol

  • @eagletgriff
    @eagletgriff 7 месяцев назад +2

    New favorite channel

  • @AzH489
    @AzH489 2 года назад +3

    I’ll start learning C just so I can understand this meme

  • @그냥사람-e9f
    @그냥사람-e9f 2 года назад +1

    "Yeah you gotta compile it to javasc[censored]t it can't run typesc[censored]t natively"

  • @PhilfreezeCH
    @PhilfreezeCH 2 года назад +47

    At least they are one of a few governments that is trying to ditch Windows in favor of Linux for their state apparatus, which I think is a great thing to do.

    • @dumbstuff2809
      @dumbstuff2809 2 года назад +19

      Well, North Korea did it first.

    • @spl420
      @spl420 2 года назад

      @@dumbstuff2809 they violated gnu GPL, so fuck them.

    • @honkhonk8009
      @honkhonk8009 2 года назад +1

      The US just uses another OS specifically designed for government use. Its not linux but its based off UNIX like linux was.
      They use windows sometimes but mostly uses that specific OS.
      Especially on the F35

    • @Nick-vd7cg
      @Nick-vd7cg 2 года назад +4

      @@honkhonk8009 most backends everywhere run on Linux. Even Microsoft themselves use Linux backends. Clouds,servers whatever.. all Linux

    • @Φωτό-ρ7π
      @Φωτό-ρ7π Год назад +2

      @@Nick-vd7cg torvalds moment

  • @legendrags
    @legendrags Год назад +2

    Me who was about to release an entire stacked app in china:

  • @buizelmeme6288
    @buizelmeme6288 2 года назад +3

    0:29 I hear "in Hong Kong" in Chinese XD

  • @user__
    @user__ 4 месяца назад +1

    no joke, I literally started learning C to understand this meme 🤣

  • @oneofthechannelsofalltime
    @oneofthechannelsofalltime Год назад +10

    You know there are too many programmers in the world when there are designated RUclips channels shitting out "relatable" programming memes.

  • @modscreator816
    @modscreator816 2 года назад +1

    Lol the description is just like me 😂🔥

  • @siyustuff213
    @siyustuff213 2 года назад +3

    aight time to go learn C so I can come back and understand this meme

    • @siyustuff213
      @siyustuff213 Год назад

      update: i learned c and am chinese but still do not understand this meme. send help.

    • @jlalbuquerq
      @jlalbuquerq Год назад

      Buffer overflow

    • @DatBoi_TheGudBIAS
      @DatBoi_TheGudBIAS 7 месяцев назад

      ​@@siyustuff213unsafe scanf
      Using %s reads a string of any size, thus the user has the hability to write like 60 chars and write beyond the allocated input array. It should be %9s to limit it to 9 chars read, cuz 10th slot is for \0

  • @BBDeathPlayer
    @BBDeathPlayer 2 года назад +1

    Anyone else getting a Chinese ad on this video?

  • @TechnoSan09
    @TechnoSan09 2 года назад +4

    This joke is brilliant
    Scanf is bad at getting string inputs
    And also getting a opinion from a public(getting input from user) is not allowed in china

  • @ВладДок-д8щ
    @ВладДок-д8щ 2 года назад +11

    I thought it would be about him using char instead of wchar_t. That's very illegal for chinese input

  • @Lumpy970253
    @Lumpy970253 5 месяцев назад +1

    As a native Mandarin speaker from Taiwan, the fake subtitles at the end makes me understand how do the Germans feel like when they watch Downfall parodies lol

  • @GordenRamsi20
    @GordenRamsi20 2 года назад +6

    When so I'm guessing next up is China++?

  • @GigaJinGaming3711
    @GigaJinGaming3711 Год назад +1

    The incident of Tiananmen Square protests and massacre happened In june 4th, 1989. this incident was primarily caused by the death of General Secretary Hu Yaobang, economic reforms, overinflation and corruption, to which the results led to Many students during their demonstrations being killed by Chinese troops, Pro-Democracy movements and enforcement of martial law.

  • @demonking3673
    @demonking3673 Год назад +11

    Coding for Genshin Impact be like:

  • @joanestradaramos1541
    @joanestradaramos1541 Год назад +1

    The joke is that great tech companies use chinese code

  • @bedeuhdb27y9
    @bedeuhdb27y9 4 месяца назад +1

    They actually write directly in binary

  • @segefjord
    @segefjord 2 года назад +5

    This had so many layers lmfao

  • @p13k4r3
    @p13k4r3 Год назад +32

    The code reads input from the user using the scanf() function and stores it in the input array of characters. However, there are several potential problems with this code that could lead to errors or unexpected behavior:
    The size of the input array is limited to 10 characters, but there is no check to ensure that the user's input does not exceed this limit. This can result in a buffer overflow, which can lead to a program crash or other security issues.
    The %s format specifier used with scanf() can read a string of characters terminated by whitespace or a newline character. If the user inputs a string that is longer than the size of the input array, or contains whitespace, the behavior of the program is undefined.
    The scanf() function returns the number of input items successfully matched and assigned, but the code does not check this return value. If the user enters input that cannot be assigned to the input array (e.g., a non-string value or a string longer than the array), the program will not know that an error has occurred.
    To address these issues, you could modify the code to use a safer input function such as fgets() instead of scanf(), and add checks to ensure that the user's input does not exceed the size of the array.
    For example
    #include
    #include
    int main(void) {
    char input[10];
    printf("Enter input (up to 9 characters): ");
    fgets(input, sizeof(input), stdin);

    // Remove trailing newline character from input
    size_t len = strlen(input);
    if (len > 0 && input[len-1] == '
    ') {
    input[len-1] = '\0';
    }

    return 0;
    }
    In this modified code, fgets() is used to read input from the user, and the sizeof() operator is used to ensure that the input does not exceed the size of the input array. The code also removes any trailing newline character from the input using strlen() and input[len-1] = '\0'. Additionally, you could check the return value of fgets() to ensure that input was successfully read, and handle any errors accordingly.
    source: ChatGPT

    • @timesnewrman
      @timesnewrman Год назад +7

      I thought it was legitimate programming comment

    • @DatBoi_TheGudBIAS
      @DatBoi_TheGudBIAS 7 месяцев назад

      scanf("%9s", input)
      Then make a function for buffer clearing, most known one is:
      Int c;
      while ((c = getchar()) != 10 && c != -1);

    • @DatBoi_TheGudBIAS
      @DatBoi_TheGudBIAS 7 месяцев назад

      (I forgot it if is an AND or an OR)

  • @joshk7893
    @joshk7893 2 года назад +2

    after coming back from learning C, I get it

  • @houba1263
    @houba1263 2 года назад +4

    Buffer overflow incoming

  • @heferh4320
    @heferh4320 Год назад +1

    dang, i didn't knew that scanf was that lethal

  • @Dark_Brandon_2024
    @Dark_Brandon_2024 Год назад +4

    print("Tiananmen square massacre 1989")

  • @allinmyvision
    @allinmyvision Месяц назад +1

    Wow we have very similar profile!

  • @zjz1
    @zjz1 2 года назад +11

    You are supposed to code in E (易) not C.
    调试输出("Hello, world!")

  • @danielawesome36
    @danielawesome36 2 года назад +1

    Bruh why am I getting coding memes on my Recommended I don't even😭😭😭

  • @Jewbender
    @Jewbender 2 года назад +38

    scanf("%9s", input)

  • @msjahun
    @msjahun 2 года назад +12

    I was thinking since I know a little C and programming I will live as a hero with high social credit in China but then I remember all the unsafe code I've written 😂😂

  • @hrishikeshkashyap3715
    @hrishikeshkashyap3715 6 месяцев назад +1

    He forgot to give the "&" symbol before "input" in the scanf statement.

  • @lunedefroid8817
    @lunedefroid8817 2 года назад +3

    China: your code is unsafe, -100 social credit, code better next time
    US: thanks for your input, we really appreciate your contribution, unfortunately we cannot accept your PR , if there is something you wish to talk about, please contact the employee satisfaction insurance team

  • @sanneoi6323
    @sanneoi6323 6 месяцев назад +1

    We like to keep all our code very secure. Not even our video games can be hacked and we like it that way.

  • @defacube
    @defacube 2 года назад +12

    for most people who don't know C, including me, scanf() is like the main thing for every input.
    For example:
    scanf("%i", &inputvariable)
    printf("%i")
    Output:
    (the thing you entered in the input)
    Atleast I'm pretty sure it's like that...

    • @briscola324
      @briscola324 2 года назад

      No , it's not

    • @skylo706
      @skylo706 2 года назад +4

      Basically yes but its more complicated than that

    • @zerg350
      @zerg350 Год назад +2

      it's just like cin in C++?

    • @schwingedeshaehers
      @schwingedeshaehers Год назад

      Than enter a really long input, and you write something In storage, that is probably used for something else

  • @frytura
    @frytura 6 месяцев назад +1

    missed the opportunity to make the vscode logo into a wechat or something

    • @Mizu2023
      @Mizu2023 3 месяца назад

      wecode lmao

  • @raianmr2843
    @raianmr2843 2 года назад +5

    no wonder Go is so popular there lmao

  • @facundoacosta595
    @facundoacosta595 Год назад +1

    Why RUclips recommend me a add from Albion online, but Chinese

  • @edunery
    @edunery 2 года назад +7

    You can limit scanf using some notation in the formating. My professor used that in vietnam.

    • @phillipanselmo8540
      @phillipanselmo8540 2 года назад +1

      your professor is a war veteran and computer scientist?? based

    • @lagseeing8341
      @lagseeing8341 2 года назад +2

      And we still lost the war?

    • @DatBoi_TheGudBIAS
      @DatBoi_TheGudBIAS 7 месяцев назад

      Just add a number lol
      %9s

    • @edunery
      @edunery 7 месяцев назад

      @@DatBoi_TheGudBIASthat's one way to do it. using [^
      ] takes until the line break.

    • @DatBoi_TheGudBIAS
      @DatBoi_TheGudBIAS 7 месяцев назад

      @@edunery ye, I use this tactic too when I want to read not only a word, but a whole string like phrase

  • @aiuno
    @aiuno 9 месяцев назад +1

    wait until you learn about the engineer leaking the police database credentials, leading to every person in shanghai getting their full name, address and phone numbers leaked.

  • @mfThump
    @mfThump 2 года назад +6

    "VSCode LMAO"

  • @Michael-pp8lz
    @Michael-pp8lz 11 месяцев назад +1

    My c++ professor is from China. I'm going to show her this video

  • @da_stoaz
    @da_stoaz 2 года назад +2

    Our dear Professor Weiß be like

  • @claudio169
    @claudio169 2 года назад +4

    To everyone that doesn't understand... i don't get it either. But the siren was funny

  • @poweroff1225
    @poweroff1225 4 месяца назад +1

    i deadass though using scanf made codes unsecure and i started worrying so much😭😭

  • @eliaquimjorras257
    @eliaquimjorras257 2 года назад +13

    I'm learning C and I read string with scanf, why not recommended to use it? What is recommended to read strings in C?

    • @Lukyen
      @Lukyen 2 года назад +16

      You are vulnerable to a stack overflow. You limit the string to 10 characters in the stack but the string you get is not limited to 10 characters. So it can overflow and overwrite memory in certain places you dont want it to. Causing problems.

    • @eliaquimjorras257
      @eliaquimjorras257 2 года назад +3

      @@Lukyen thanks

    • @quangvanduy1151
      @quangvanduy1151 2 года назад +2

      use fgets instead

    • @raymundhofmann7661
      @raymundhofmann7661 2 года назад +11

      Either use "scanf("%9s", input)" to limit the number of characters read to 9 and have the zero terminator to get 10 or better C++ and std::string.

    • @daybot1634
      @daybot1634 2 года назад

      Your output would be like this "HelloWorld�[�G�"

  • @elotkarloketh166
    @elotkarloketh166 Год назад +1

    We can't make choice on our device with the latest version of softwares, this is what big tech have done and I think big tech really love "China"(government)

  • @justplay2508
    @justplay2508 7 месяцев назад +3

    You're using vs code a western software you already messed up

  • @lamy1057
    @lamy1057 4 месяца назад +3

    fake, they are writing code 10x faster