Advice for Writing Small Programs in C

Поділитися
Вставка
  • Опубліковано 7 чер 2024
  • -- Watch live at / nothings2

КОМЕНТАРІ • 145

  • @JoeMarrero-manvscode
    @JoeMarrero-manvscode 9 років тому +125

    I too found myself going back to C after many years of writing C++.

    • @GamingBlake2002
      @GamingBlake2002 4 роки тому +11

      @Digital Nomad Haskell for low level programming? Wat.

    • @jespa003
      @jespa003 4 роки тому +1

      me too

    • @sortof3337
      @sortof3337 Рік тому +2

      Dude that's every cpp developer.

    • @roymarshall_
      @roymarshall_ 5 годин тому

      I don't get it. C++ is great. C and C++ both have their use cases.

  • @user-tt4dy1ti5v
    @user-tt4dy1ti5v Рік тому +29

    Q&A
    22:11 Are you using a standing desk?
    51:38 Should one use the C Standard Library?
    1:00:01 Can you use regex extraction instead?
    1:10:06 Could you use a printf() trick instead?
    1:18:56 Can you recommend some good programming books?
    1:19:52 Why do you not cache stb_arr_len() when you're looping?
    1:22:13 What other advice would you give yourself if you go back 25 years?
    1:25:06 Have you used ImGUI?
    1:25:44 If I wanted to have my own standard library, would you think that would be better than trying to have one standard library for everyone?
    1:27:46 Do you routinely use polymorphism with void* and function pointers in your C programs?
    1:29:42 Is stb_arr_len() safe?
    1:34:42 Can you create a debug GL context in SDL2?
    1:34:59 Is it slow to open the debug GL context through SDL2?
    1:35:20 What are the more simple STB libraries for beginners to start playing with?
    1:35:50 Don't you think it's a good idea to rewrite the tools incorporating new knowledge to make the most impact?
    1:39:40 Do you think with enough STB-like libraries out there eventually that C would be more competitive with higher-level languages in the future?
    1:42:46 Are you using MS Visual C++6 for your IDE?
    1:43:02 Is it wise to play with STB by looking at the library code?
    1:45:02 Would you consider a specific pull request?
    1:45:15 [wrap up]

  • @notanotherreviewer.
    @notanotherreviewer. 9 років тому +80

    Never stop streaming, you're amazing.

  • @CNLohr
    @CNLohr 7 років тому +157

    YOU'RE THE GUY BEHIND STB? THANK YOU!!!!

    • @CNLohr
      @CNLohr 7 років тому +3

      I commented this at your first mention of stb early in the talk.

    • @wessmall7957
      @wessmall7957 4 роки тому +8

      Small programming world out there, I see all the same people everywhere I go when I'm researching.

    • @danielrazulay
      @danielrazulay 3 роки тому +5

      Hey! You're that guy who does insane stuff with ESPs!? haha

    • @cali-co6428
      @cali-co6428 2 роки тому +1

      @@danielrazulay you meant insane guy who does stuff on esps? Lol

    • @vke6077
      @vke6077 28 днів тому

      @@danielrazulay yeah wtf XD truly a tiny world

  • @StevenSmith-qz9zg
    @StevenSmith-qz9zg 6 років тому +8

    Thank you! I learned quite a bit, especially about some of the meta-data behind programming at a lower level. One thing - the reason for doing this (making a video) is, at least for me, for those that always wanted to program, loved computers, were plenty into it, but didn't necessarily have the resources (friends, relatives, teachers, etc) to learn from in order to advance their knowledge. So what you're doing is awesome for those types (like myself..) :) Thank you! :D

  • @Muck-qy2oo
    @Muck-qy2oo 4 роки тому +79

    I think C is more straight forward than C++ and also more clear.

    • @JoeMarrero-manvscode
      @JoeMarrero-manvscode 4 роки тому +15

      Yeah. C is amazing in it's minimalism and simplicity.

    • @totheknee
      @totheknee 3 роки тому +5

      But operator overloading for math vectors...

    • @CianMcsweeney
      @CianMcsweeney 3 роки тому +3

      @@totheknee well you could use a small subset of C++ in a C way to access some of it's features

    • @buzzwordchief
      @buzzwordchief 3 роки тому +5

      @@totheknee That is probably one of the most bug causing features in C++. Overloading operators is a no go.

    • @pseudopseudo3679
      @pseudopseudo3679 2 роки тому +1

      @@CianMcsweeney i do this too, just don't tell anyone who codes c++ :D

  • @gregg4
    @gregg4 7 років тому +199

    Seeing him programming like this, making mistakes and so on, it makes me feel a lot better as a programmer. They all go through that, it's not just me.

    • @jonaskoelker
      @jonaskoelker 4 роки тому +56

      I remember hearing in a talk, I think by Joe Armstrong of Erlang fame, the speaker say something like the following
      > when I used to live code in the classroom, my students would remark "it's so relieving seeing you [the professor] make all the same mistakes as us; the only difference is that you spot and fix them faster thanks to experience".
      It made me feel less sucky when I heard it :-)

    • @jamesevans2507
      @jamesevans2507 2 роки тому

      @@jonaskoelker you people are pussies I swear to god. I bet you feel all warm and mushy when someone tells you that you're not supposed to constantly be sh*tting out perfect code.

    • @RogerBarraud
      @RogerBarraud Рік тому +12

      The same applies to mathematicians and mathematics.
      I remember being told (i person, up the front after a lecture) that maths is actually messy and full of false trails; the texts never show the failed workings, or mention alternative formulations (due to space and (author + reader) attention constraints among other things).

    • @whannabi
      @whannabi 7 місяців тому

      If you imagine that every problem you have was something someone also struggled with, you'll feel better because it's true.

  • @Ryan-xq3kl
    @Ryan-xq3kl 3 роки тому +9

    If you make another video on coding tips I would totally watch, thanks for this

  • @anthonypacitto3958
    @anthonypacitto3958 6 років тому +6

    Love watching his streams and videos on programming. Super intelligent and always a fan of his fluent C work.

  • @higor129
    @higor129 4 роки тому +50

    Hey Sean, this video will soon be 5 years old. Are there things you would like to add to it or that you now think differently about?

    • @JoeMarrero-manvscode
      @JoeMarrero-manvscode 4 роки тому +6

      +1

    • @cafeyt01
      @cafeyt01 3 роки тому +2

      Yeah, we have developed code syntax highlighting since... well...

    • @JoeMarrero-manvscode
      @JoeMarrero-manvscode 3 роки тому

      C D it looks like he’s still responding on tweeter

    • @JoeMarrero-manvscode
      @JoeMarrero-manvscode 3 роки тому +3

      @C D I don't know. Maybe he's busy. Maybe he's answering other questions. Maybe he doesn't want to answer the question.
      But he does appear to be alive so let's not spread rumors.

    • @rodgermilner7800
      @rodgermilner7800 2 роки тому

      @@cafeyt01 sometimes can be distracting, I often use a mono theme

  • @littlecurrybread
    @littlecurrybread 7 місяців тому +1

    Looking glass one of the goat studios. Legendary

  • @adama7752
    @adama7752 Рік тому +2

    It's the current year, and I literally have a supercomputer. It's watercooled and spinup sounds like an aircraft carrier.
    Yet, compiling takes longer than vs6.

  • @sortof3337
    @sortof3337 Рік тому +2

    omg, watching after 7 years. still very relavent and useful advice. :D

  • @calumlindsay
    @calumlindsay Рік тому +1

    I immediately had to try making my own dynamic arrays! I got it working although I'm not sure how similar it is to your implementation.. I definitely would like it to be more elegant though, currently you can't pass rvalues to my push function D: 😂 Anyway great talk! thank you for that! and all your amazing contributions to the community!

  • @thomchiovoloni3877
    @thomchiovoloni3877 8 років тому +3

    I think you should be able to use memcpy/memmove to work around strict aliasing issues for the stb array code. That is, you'd have to memcpy (from type* or void*) onto a temporary stb__arr struct in order to do reads, and the reverse to do writes. Hopefully that makes sense. It is/would be ugly, but could be worth keeping in mind if you ever need to get the stb array stuff working in the face of strict aliasing optimizations.
    Totally agree that strict aliasing is annoying though. Ideally compilers wouldn't do that, except when asked to e.g. with `restrict`...

  • @santiagolerin
    @santiagolerin 11 місяців тому +1

    This is one of the good ones. The algorithm takes me back here at least once every 6 months. Even though it's at least the sixth time, im watching again

  • @MikaelIsaksson
    @MikaelIsaksson Рік тому +2

    Finally someone who has been coding for longer than me :). Worth a sub to check out your content.

  • @dime776
    @dime776 7 років тому

    I love your videos, watching both you and Shawn Mcgrath have inspired me to fulfill my dream of programming in C and C++, thanks a lot!

  • @openroomxyz
    @openroomxyz Рік тому +1

    Thanks for creating stb

  • @asddsa10001
    @asddsa10001 6 років тому +53

    Thanks a lot for this interesting video. Since the early 2017, I have switched to C for writing all my works and I am so happy about this decision I made. After 1 year, I wrote many C codes that are fast, easy to debug and very portable. I will never regret switching to C from all the interpreted languages or even C++.

    • @alefratat4018
      @alefratat4018 4 роки тому +3

      Same story here.

    • @keyhanjannatkhah6729
      @keyhanjannatkhah6729 Рік тому +1

      same story for me too

    • @openroomxyz
      @openroomxyz Рік тому +1

      Are you still using C ?

    • @lucasjames8281
      @lucasjames8281 10 місяців тому

      In what world is c more portable than python

    • @CaptainWumbo
      @CaptainWumbo 10 місяців тому +5

      @@lucasjames8281 C can be written for memory constrained devices or take better advantage of powerful hardware when datasets are large, which is sometimes a dealbreaker if the equivilent code in a memory managed language would be prohibitively slow.

  • @pseudopseudo3679
    @pseudopseudo3679 2 роки тому

    What kind of documentation has been used for a large project like this?
    Have you found the best way of keeping track for you?

  • @Kenbomp
    @Kenbomp 4 роки тому

    Nice. Anything to boost. Though for beginners it's probably better to not use it but still nice to have out there. Whats that window or ide?

  • @GendoIkari
    @GendoIkari 4 роки тому +7

    OMG you worked on thief!!

  • @magik603
    @magik603 8 років тому +7

    Great talk.
    The industry needs more people like you.
    Also Thief:Tdp is the bomb!

  • @AleksyGrabovski
    @AleksyGrabovski 2 роки тому

    Thanks for you lib and good stream. I'll consider stb in a professional work.

  • @rdoetjes
    @rdoetjes 3 роки тому +3

    For a brief moment i though Iron Maiden’s Dave Murray was doing C :)

  • @GeorgeTsiros
    @GeorgeTsiros 7 років тому +2

    42:50 omg he laughed :D

  • @aaronoman6460
    @aaronoman6460 9 років тому +2

    Is there a link for that "What programming is not about" talk? I quick search didn't turn up any relevant results. May be a pebcak problem.

    • @GeorgeTsiros
      @GeorgeTsiros 7 років тому

      in case you didn't find it, it coincidentally appeared on the suggested videos on the right "What Programming is Never About (Informal Lecture)"

  • @pierce8308
    @pierce8308 3 роки тому +3

    omg that 1999 visual studio is so sick compared to the versions now. sucks i cant find the version online

    • @sw97058
      @sw97058 3 роки тому +2

      I just use VSCode and turn most stuff off

    • @fullcyber
      @fullcyber 2 роки тому

      vs 6 is available on the-eye[dot]eu in the msdn archive

  • @mt-qc2qh
    @mt-qc2qh 3 роки тому +4

    I use PHP as a scripting language, because I like the C-like syntax, but for something small I don't like strict typing.

  • @SwirlOfColors
    @SwirlOfColors 8 років тому +2

    The talk - What programming is never about - he mentions is here:
    ua-cam.com/video/Lzc3HcIgXis/v-deo.html

  • @HersonBagay
    @HersonBagay 8 днів тому

    This is so hardcore he's using HTML as PowerPoint

  • @porky1118
    @porky1118 Рік тому +2

    20:48 I recently wrote some utilities, not necessarily "small" programs, writing them took a some hours and I had to fix some bugs in the following days in Rust. It's not C, but also not a scripting language like bash, python, perl, etc., and I think, it was a good idea.

  • @ryonagana
    @ryonagana 4 роки тому +2

    visual c++ 6.0 (98) on background
    cool!

  • @xbz24
    @xbz24 Рік тому

    Testing testing…

  • @justcurious1940
    @justcurious1940 Рік тому +1

    seeing a snake moving in the console is the best thing i saw in a year, what a sad and pathetic life I have.

    • @x_flies
      @x_flies 10 місяців тому

      😂. You’re a legend.

    • @justcurious1940
      @justcurious1940 10 місяців тому

      @@x_flies I wrote 80 lines of codes to achieve that, without looking to any tutorial online, I saw just the beginning of a youtube video where the guy who made the video spoke about using the function system("cls") to clear the screen.

  • @CarlJohnson-jj9ic
    @CarlJohnson-jj9ic 3 роки тому +2

    Please do a video on the C abstract machine layer communication theory, x8086 PC AT assembly communication theory, and the translation between them as three independent discussions. That is what I am going to work towards. You could use sockets as a basic language parallel but the video should be independent of any library dependencies including sockets.h. The process and controlling expressions must be self contained to C/Assembly so that it's constraints are plain. For example, an inherent C design limitation is not being able to modify the symbol table from within the program at run time(I am still learning). The symbols must be found in the native character set of ASCII excluding the control characters(96), or the symbols(keywords such as 'if' or operator '=') in the Standard without the standard library('setjmp' as opposed to 'goto label' would require an Assembly explanation within the C discussion). Support for your explanation and preferences with direct citations to the the standard, say C99 or earlier for conservative compatibility, data sheets for the PC AT x8086 including the word sets(timing, resolution and sequences) or its standard, or real world experience to proffer new people like me. A fourth good topic would be the previous three topics as it concerns the controlling design limitations in the language and translations between such as symbol table and external linker. A fifth, BIOS interface.

  • @Necrometr
    @Necrometr 3 роки тому +1

    How can you know what parts of code you will reuse until you have 20 years of experience? You can end up implementing code that you'll never use ever again.

    • @pqsk
      @pqsk 3 роки тому

      You dont need 20 years, you just have to identify what you do a lot and make it reusable. It does take time, but NOT 20 years. Sure after 20 years you should already know, but you would also have written a lot of it

    • @familyshare3724
      @familyshare3724 Рік тому +2

      Write it first. Make it better the next time. Make it reusable the third time.

  • @EvanTeran
    @EvanTeran 9 років тому +8

    Interesting video, but I have an honest question. Much of your libraries are to a degree, reinventing what is already done in c++'s standard library. For example, your dynamic array implementation very much mirrors to implementation of std::vector. Both store 3 pieces of information (size, capacity, the base ptr itself). Both have appending to with "push" and will resize if needed. both offer array style indexing.
    It's pretty cool that you were able to do this in c, the idea of packing meta-data in a struct before the base address is something that I'm familiar with from allocators, but using it in this context is very clever, I'll probably use that trick more often myself :-).
    Well, I haven't actually asked a question yet, so here it goes. Why not use a limited subset of c++ to maximize code reuse? Are there any specific benefits to your implementation over the similar std::vector?
    The reason why I ask is that as you state, the c stdlib is very limited, but the c++ one is quite a bit larger. At the same time, there is nothing wrong with writing very c-style code with a c++ compiler. Why not have the best of both worlds?
    Anyway, just curious because I found some of this interesting.

    • @tomcheng3903
      @tomcheng3903 7 років тому +1

      Because everyone does this, everyone uses a slightly different subset of C++, which makes maintaining C++ code a nightmare

    • @EvanTeran
      @EvanTeran 7 років тому +2

      @Tom Cheng, I suppose that this is something that we'll just disagree on. The way I see it, the vast majority of C++ is quite straight forward, and doesn't require esoteric knowledge to work with. Sure, there are some parts that feel like they are WAY too complex, but the reality is that things like SFINAE are largely a tool for library writers, not everyday coders.
      In my opinion, it's quite easy to stick to a subset which any competent C++ developer would be able to work with. For example, if you wrote code that was basically plain old C, but instead of manually managing strings, you just used std::string, do you really feel that anyone is going to have a hard time following or maintaining that? OK, how about if we add usage of a std::sort?
      Sure, at some point, you're bound to include some feature that not everyone understands, but I think that those are pretty easy to identify and avoid if feel the need. Don't like templates? don't use them! Don't like exceptions? same deal.

    • @tomcheng3903
      @tomcheng3903 7 років тому +3

      It's not that some people don't understand std::string, it's just that using a subset of C++ on a project requiries much greater management to make sure that everybody's using the same subset. I can choose not to use exceptions for example, but if anybody else on the project is using them, I'm totally fucked and I'll be leaking memory everywhere because I haven't wrapped all my resources in objects (RAII)
      If something goes wrong in a C++ codebase, it could be 1000 things. In a C codebase, only 100.
      Lil side note, check out Rust! This is the best 'best-of-both-worlds' solution I've seen so far, and seems to keep up / beat c/c++ performance wise

    • @thalesfm
      @thalesfm 7 років тому +2

      I really want to see what a great compiler for Rust would look like. It could do some crazy stuff with ownership, the kind of stuff that compiler-writers nowadays can only do based on undefined behavior (at the expense of many programmers sanity). I bet a really good Rust compiler could produce faster programs than C code.

    • @tomcheng3903
      @tomcheng3903 7 років тому +1

      I think the current limitations are in the LLVM backend, some of the stuff the rust compiler can do semantically just don't translate well?
      That being said, rust is already faster than C code in a lot of places. Take a look at 'ripgrep', a rust implementation of grep which I believe is faster than the original.
      The main benefit is that rust code is so robust, that at a certain project scale you can reach speeds you never could do safely with C. Writing fast C code in a huge project is very hard, unless the only people to have worked on it to date followed really strict procedures.
      Writing a big project like that in rust, the compiler enforces the procedures onto you - I think this is probably the main argument for rust being faster than C. It's just like how assembly is probably faster than C, but realistically it's too hard to write a whole project in assembly b/c it gets too hard to write past a certain scale.

  • @ryonagana
    @ryonagana 4 роки тому +5

    a question do you recommend using C for gamedev instead C++?

    • @johnjackson9767
      @johnjackson9767 4 роки тому +10

      I certainly do.

    • @hellboy6507
      @hellboy6507 4 роки тому +4

      Is recommend C++ if you know how to to use its better features.

    • @Mateus.007
      @Mateus.007 4 роки тому +1

      @@johnjackson9767 What types of data struct is used with C? Because in OOP languages is common use virtual functions to just write a for loop and update all in the game.

    • @nac9880
      @nac9880 4 роки тому +2

      Their comments are biased, ma'am

    • @MrAbrazildo
      @MrAbrazildo 2 роки тому

      C++ is the best, even more for games.

  • @skeleton_craftGaming
    @skeleton_craftGaming 8 місяців тому +1

    Yes, visual studio has gotten significantly better since then. Like it is now one of the best IDEs I know of

  • @Gubber
    @Gubber 9 років тому +2

    Why do the libraries contain many defines instead of functions?

    • @LagMasterSam
      @LagMasterSam 3 роки тому

      Good question. I might be wrong, but for some reason I'm thinking actual functions can be optimized by the compiler while defines cannot.

    • @fiveprime7968
      @fiveprime7968 3 роки тому

      Functions have an overhead on the CPU for calling them. Registers and the stack get used for passing parameters, then the CPU has to jump to a different memory address to read the function code, then it often has to restore the registers to the state they were and jump back, all of these take clock cycles. A #define just replaces the word in your program with the code before the file is even compiled, so none of those steps are necessary. In short, it’s just faster if you can do it that way.

    • @krystofjakubek9376
      @krystofjakubek9376 2 роки тому

      In c its impossible in many cases to write code that is type independent which you oftentimes want (for example when working with vectors) so you can cleverly use macros that just take the name of your variable and do your operation in line like that. The performance cost is negligible and if it wasn't the compiler would probably in-line it for you (c has very good optimizers by now so you need not worry)

    • @tourdesource
      @tourdesource Рік тому

      @@fiveprime7968 That's what the inline keyword is for.

  • @nac9880
    @nac9880 4 роки тому +2

    That's the longest advice ever

  • @5Gazto
    @5Gazto 6 років тому +5

    I like how he uses HTML to say "Fuck you!" to overly priced presentation programs.

  • @mvargasmoran
    @mvargasmoran 3 роки тому

    49:08 what the hell...

  • @user-pm2ru6ir6n
    @user-pm2ru6ir6n 4 роки тому +3

    Faster to write 10 lines on php, than to load IDE; If you have a big project on c ++, like a game, then programming turns into a continuous compilation. Debugging game logic in c / cpp is awesome. You have to attach scripting languages, and even so that it does not lag. I lead to the fact that there is a tool for everything, and the programmer must be able to choose it correctly. This is a key point.

  • @atilafernandes217
    @atilafernandes217 2 роки тому +1

    [7:20] Here is my C++14 Python-like version (produces the same result):
    #include "python" //Python: #!/usr/bin/python
    by_(anagram) = {}; //Python: by_anagram = {}
    auto names_file = open ("dist.male.first"); //Python: names_file = open ("dist.male.first")
    for_line (in names_file); //Python: for line in names_file:
    auto name = (line.split())[0]; //Python: name = (line.split())[0]
    auto letters = (letter_for_letter_in_name); //Python: letters = [letter for letter in name]
    letters.sort(); //Python: letters.sort()
    auto sorted_name = ""_join (letters); //Python: sorted_name = "".join (letters)
    if _not sorted_name in_by_anagram //Python: if not sorted_name in by_anagram:
    by_anagram[sorted_name] = {}; //Python: by_anagram[sorted_name] = []
    by_anagram[sorted_name].append (name) //Python: by_anagram[sorted_name].append (name)
    for_(sorted_name, in by_anagram) //Python: for sorted_name in by_anagram:
    if (len (by_anagram[sorted_name]) < 2) //Python: if len (by_anagram[sorted_name]) < 2:
    continue; //Python: continue
    print (by_anagram[sorted_name]) //Python: print by_anagram[sorted_name]

  • @Levelworm
    @Levelworm 4 роки тому +1

    Is that actually Visual C++ 6.0?

    • @SeanTBarrett
      @SeanTBarrett  4 роки тому +3

      ua-cam.com/video/3BYKiOHdCNg/v-deo.html

    • @Levelworm
      @Levelworm 4 роки тому

      @@SeanTBarrett Thanks! This gives me nostalgic as I played with VC++ 6.0 many many years ago. Although I never went into programming officially that was still fond memory. BTW thank you for your videos and your games!

  • @naikrovek
    @naikrovek 9 років тому +4

    Totally respect your skill, and knowledge, so don't take this the wrong way. I think people that blithely shrug off newer tools without looking into them to be making a rather silly mistake. Never willfully ignore something that could save you a lot of time in the long run. I can't find much virtue in using a single language for all of your utilities, either. What you demo in the video (finding stb_ tokens) could be done in 30s with a tiny bit of Perl knowledge that it would not take long for someone intelligent such as yourself to learn.

    • @aaronoman6460
      @aaronoman6460 9 років тому +3

      naikrovek He seemed to pretty clearly suggest taking that approach for the viewer and that his approach works for the specific niche he's carved in his own life.
      That doesn't take away from your point, but your point *is* reiterating what was mentioned in the video.

    • @unclelindsey2068
      @unclelindsey2068 9 років тому +14

      naikrovek Totally agree. They should have written Linux in Python.

    • @naikrovek
      @naikrovek 9 років тому +3

      ***** yes. That is EXACTLY what I said.

    • @unclelindsey2068
      @unclelindsey2068 9 років тому +13

      Sarcasm.

    • @GeorgeTsiros
      @GeorgeTsiros 7 років тому +5

      sooo because the openSSL devs did not do proper argument checking, it's somehow C's fault?

  • @MrAbrazildo
    @MrAbrazildo 2 роки тому

    8:10, using C++, I achieved this in 30 lines, with no extra file else than its own standard lib., STL.
    9:34, in C++, you can just write a lambda f(), which is a f() inside that quick sort. No wonder why I leaved C.
    10:55, writing games in C is kind of a suicide to me. 11:38, C++ is the best for games and anything else.

    • @aiman_yt
      @aiman_yt 2 роки тому +1

      You can do even better in Rust. C++ is a sinking ship full of bloat and bs

    • @MrAbrazildo
      @MrAbrazildo 2 роки тому

      @@aiman_yt I'm waiting _Dave's Garage_ make a benchmark from those 2 and C. It's hard to compete against C++ wonderful resources.

    • @trefwoordpunk2225
      @trefwoordpunk2225 2 роки тому +1

      "10:55, writing games in C is kind of a suicide to me" - well that's the difference between a bedroom script kiddy and a GENIUS like Eskil Steenberg!!!

    • @MrAbrazildo
      @MrAbrazildo 2 роки тому

      @@trefwoordpunk2225 Dude, I was successfully fighting against global/public variables (C-style) while you still was pooping and rubbing your feces in your face. If he managed to tame the beast, he may indeed be a genius. However, for instance, he said he is always afraid to access an array in the cache - and his method to prevent errors in the heap is clunky as hell. This is for me a long time gone issue: I access any kind of array safely, without adding any line of code, leaving the entire work automatically for my lib. in C++.

    • @trefwoordpunk2225
      @trefwoordpunk2225 2 роки тому

      @@MrAbrazildo when I was still pooping and rubbing shit in my face? Last week then?

  • @skeleton_craftGaming
    @skeleton_craftGaming 8 місяців тому

    The best replacement for the standard c library, and this is going to be controversial, is C++'s standard template library

  • @skeleton_craftGaming
    @skeleton_craftGaming 8 місяців тому

    11:33 That didn't age well , of the three major game engines with available source All of them are written in C++..

  • @Kenbomp
    @Kenbomp 4 роки тому +3

    As long as you're not making window GUI programming windows in c is fine..

  • @the_original_dude
    @the_original_dude 9 місяців тому

    It's quite funny how you advocate for writing small programs in C, but spend quite a bit of time debugging trivial code.
    With Python stuff just works. Easy install and usage, unicode by default, a traceback on errors, ALL unhandled errors are caught, a plethora of libraries with a sane API, string formatting.
    Sure, there are still moments when you'll make a mistake or will have to figure out some gotcha, but those are so much easier to catch in Python.
    When I need to automate something for personal use, I don't even think whether I should do it, I just do it, because it's just a few minutes.
    I'm all for C for serious programming, but when it comes to writing scripts/small programs there's pretty much no reason to avoid the obviously right tool for the job.
    The only time I would use C for a small program is when Python is not fast enough (be it single or repeated use) (which is so obvious, I don't know why I feel the need to explain it)
    It just feels like you don't have any objective reason to always use C.
    I get that it's just intended as advice to those who are inclined to use C. But this still feels like an old man's attitude.

  • @Newtube_Channel
    @Newtube_Channel 4 роки тому +3

    Spend your time writing useful code not doing other things, then what do you call this?? If Powerpoint was too much of a stretch then just get the word processor (even Wordpad) and type out the presentation that way. I sympathize who wants to rehash Powerpoint but these aren't good examples.

    • @SeanTBarrett
      @SeanTBarrett  4 роки тому +16

      "These aren't good examples." Thank you for deeply insightful commentary. Everyone who sees your comment will surely be convinced of the rightness of your opinion given your rigorously presented arguments in favor of it.

    • @Newtube_Channel
      @Newtube_Channel 4 роки тому +1

      @@SeanTBarrett This isn't the right place to present any rigor. I hope you can understand that it's a little frustrating being hung up on a presentation that drags on and on but makes little headway. I can try and understand your point in writing small programs but let's face it these are really just Hello World programs. If you're going to use strings in your program then you could just as well write small C++ programs using the string class. I'd rather you just type the presentation in a word processor if need be. Dare I say it, you're using the wrong tools for the wrong job. The point about C isn't as much about the size of the program as it is about accuracy.

    • @captlazerhawk
      @captlazerhawk 4 роки тому +1

      @@Newtube_Channel People can present rigor anywhere they want. In doing so present my validity to their arguments.
      We dont need a shitty white paper on every crappy algorithm that some grad student wrote to get his PHD that has been used countless times silently in many game or apps already.
      C can be used just as well with small one off programs with the write libs and if you live in a specific problem domain there is no reason you cant make it extremely efficient and get even more reusable code out of it.

    • @okaravan
      @okaravan 4 роки тому +2

      Is it a joke about PowerPoint? Because from any real developer's perspective it is absolutely stupid idea. When you have HTML, that is open standard existing for decades and can be viewed and edited on any machine that has internet browser.

  • @typon1
    @typon1 4 роки тому +7

    ironic how the guy who talks about how C is a good way of writing small programs runs into 4-5 segfaults and bugs in a simple program (literally counting words in a file).
    use split string into vector of words, find_if starting with "stb" and get on with your life. it will be faster to implement, faster to execute and less buggy.

    • @32gigs96
      @32gigs96 4 роки тому +13

      It’s not a huge issue with debuggers. Plus he was doing a talk and live coding! Ur gonna get a lot of errors when u do that.

    • @luminousmonkey4512
      @luminousmonkey4512 Рік тому +7

      Would trust Sean’s C code over any code you wrote in any other language.

  • @stephenkamenar
    @stephenkamenar 4 роки тому +2

    have you heard of JAVASCRIPT?

    • @32gigs96
      @32gigs96 4 роки тому +8

      Yeah, it’s slow af and takes a browser engine to run it... also, it has no types whatsoever so a typo is a new member in your object. U can use typescript but it’s compiler is slow af cuz it’s written in JavaScript.

  • @JelloTalks
    @JelloTalks 3 роки тому +3

    'Advice for Writing Small Programs in C'
    1:45:23
    Yup, thats C all right

  • @ryanalnaser914
    @ryanalnaser914 2 роки тому +1

    islam