Advice for Writing Small Programs in C

  Рет қаралды 149,540

Sean Barrett

Sean Barrett

Күн бұрын

Пікірлер: 160
@hzrnbugsie
@hzrnbugsie 5 ай бұрын
This is so hardcore he's using HTML as PowerPoint
@michn5711
@michn5711 2 ай бұрын
lmfaoo 9 years ago AND hes using windows 98... this cant get any better.
@Iog
@Iog 2 ай бұрын
Bro created my IDE 💀
@user-tt4dy1ti5v
@user-tt4dy1ti5v 2 жыл бұрын
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]
@JoeMarrero-manvscode
@JoeMarrero-manvscode 9 жыл бұрын
I too found myself going back to C after many years of writing C++.
@GamingBlake2002
@GamingBlake2002 4 жыл бұрын
@Digital Nomad Haskell for low level programming? Wat.
@jespa003
@jespa003 4 жыл бұрын
me too
@sortof3337
@sortof3337 Жыл бұрын
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.
@robrick9361
@robrick9361 2 ай бұрын
@@roymarshall_ I don't get it either. You can write C++ in a very C-like way but with the added convenience of namespaces, function overloading, operator overloading, default arguments, and templates to replace macros. Most people who dislike C++ were forced to do the whole polymorphism + exceptions + RAII thing and think that's the only way to write C++.
@notanotherreviewer.
@notanotherreviewer. 9 жыл бұрын
Never stop streaming, you're amazing.
@CNLohr
@CNLohr 7 жыл бұрын
YOU'RE THE GUY BEHIND STB? THANK YOU!!!!
@CNLohr
@CNLohr 7 жыл бұрын
I commented this at your first mention of stb early in the talk.
@wessmall7957
@wessmall7957 4 жыл бұрын
Small programming world out there, I see all the same people everywhere I go when I'm researching.
@danielrazulay
@danielrazulay 3 жыл бұрын
Hey! You're that guy who does insane stuff with ESPs!? haha
@cali-co6428
@cali-co6428 3 жыл бұрын
@@danielrazulay you meant insane guy who does stuff on esps? Lol
@vke6077
@vke6077 5 ай бұрын
@@danielrazulay yeah wtf XD truly a tiny world
@santiagolerin
@santiagolerin Жыл бұрын
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
@Muck-qy2oo
@Muck-qy2oo 4 жыл бұрын
I think C is more straight forward than C++ and also more clear.
@JoeMarrero-manvscode
@JoeMarrero-manvscode 4 жыл бұрын
Yeah. C is amazing in it's minimalism and simplicity.
@totheknee
@totheknee 3 жыл бұрын
But operator overloading for math vectors...
@CianMcsweeney
@CianMcsweeney 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 жыл бұрын
@@totheknee That is probably one of the most bug causing features in C++. Overloading operators is a no go.
@pseudopseudo3679
@pseudopseudo3679 2 жыл бұрын
@@CianMcsweeney i do this too, just don't tell anyone who codes c++ :D
@adama7752
@adama7752 Жыл бұрын
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.
@gregg4
@gregg4 8 жыл бұрын
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 жыл бұрын
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 2 жыл бұрын
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).
@w花b
@w花b Жыл бұрын
If you imagine that every problem you have was something someone also struggled with, you'll feel better because it's true.
@boredsherbet
@boredsherbet 2 ай бұрын
using 1999 visual studio-"things, maybe they've gotten better... but you know... probably not." pure fucking aura man.
@littlecurrybread
@littlecurrybread Жыл бұрын
Looking glass one of the goat studios. Legendary
@MikaelIsaksson
@MikaelIsaksson Жыл бұрын
Finally someone who has been coding for longer than me :). Worth a sub to check out your content.
@asddsa10001
@asddsa10001 6 жыл бұрын
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 жыл бұрын
Same story here.
@keyhanjannatkhah6729
@keyhanjannatkhah6729 2 жыл бұрын
same story for me too
@openroomxyz
@openroomxyz Жыл бұрын
Are you still using C ?
@lucasjames8281
@lucasjames8281 Жыл бұрын
In what world is c more portable than python
@CaptainWumbo
@CaptainWumbo Жыл бұрын
@@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.
@higor129
@higor129 4 жыл бұрын
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 жыл бұрын
+1
@cafeyt01
@cafeyt01 4 жыл бұрын
Yeah, we have developed code syntax highlighting since... well...
@JoeMarrero-manvscode
@JoeMarrero-manvscode 4 жыл бұрын
C D it looks like he’s still responding on tweeter
@JoeMarrero-manvscode
@JoeMarrero-manvscode 4 жыл бұрын
@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 3 жыл бұрын
@@cafeyt01 sometimes can be distracting, I often use a mono theme
@sortof3337
@sortof3337 Жыл бұрын
omg, watching after 7 years. still very relavent and useful advice. :D
@ttt69420
@ttt69420 3 ай бұрын
I like C because it's fun. I'll use whatever, though, if needed.
@Muskar2
@Muskar2 3 ай бұрын
The dynamic between what's good for small programs, through demos, betas and production is really interesting. Certainly agree that the only thing stopping people from using C more is the lack of public ecosystem (and the bad and outdated standard library). I think C is an incredibly powerful language in most of the regards people need.
@StevenSmith-qz9zg
@StevenSmith-qz9zg 7 жыл бұрын
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
@Ryan-xq3kl
@Ryan-xq3kl 3 жыл бұрын
If you make another video on coding tips I would totally watch, thanks for this
@anthonypacitto3958
@anthonypacitto3958 6 жыл бұрын
Love watching his streams and videos on programming. Super intelligent and always a fan of his fluent C work.
@openroomxyz
@openroomxyz Жыл бұрын
Thanks for creating stb
@rdoetjes
@rdoetjes 3 жыл бұрын
For a brief moment i though Iron Maiden’s Dave Murray was doing C :)
@enio.carlos
@enio.carlos 10 күн бұрын
Bro is using windows 1
@calumlindsay
@calumlindsay Жыл бұрын
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!
@magik603
@magik603 8 жыл бұрын
Great talk. The industry needs more people like you. Also Thief:Tdp is the bomb!
@RecycleBin0
@RecycleBin0 2 ай бұрын
the C standard library is probably the best library ive seen along with windows.h etc
@СергейФёдоров-щ8ш
@СергейФёдоров-щ8ш 5 жыл бұрын
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.
@thomchiovoloni3877
@thomchiovoloni3877 8 жыл бұрын
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`...
@mt-qc2qh
@mt-qc2qh 3 жыл бұрын
I use PHP as a scripting language, because I like the C-like syntax, but for something small I don't like strict typing.
@explqicot3293
@explqicot3293 2 ай бұрын
So I don’t really need to learn c++ or even modern c++ due to the foot holes and mines that one usually avoids in the language while you will still find yourself rolling out your own . And in C there’s cosmopolitan the Hvm and Ryan fleury the c99/c17 is the way it seems from reading and looking at code from developers
@justcurious1940
@justcurious1940 Жыл бұрын
seeing a snake moving in the console is the best thing i saw in a year, what a sad and pathetic life I have.
@MamaMia84oo7
@MamaMia84oo7 Жыл бұрын
😂. You’re a legend.
@justcurious1940
@justcurious1940 Жыл бұрын
@@MamaMia84oo7 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.
@ryan-kys
@ryan-kys Ай бұрын
​@@justcurious1940good for you mate. did u manipulate the console buffer or did you do something else?
@justcurious1940
@justcurious1940 Ай бұрын
@@ryan-kys No bro, what are u talking about ? I don't do illegal activities, I just used the C library system() function with "cls" as an argument, also how would u manipulate the console buffer ? it's physically not possible ?
@ryan-kys
@ryan-kys Ай бұрын
@@justcurious1940 sorry, i must've misunderstood something. you don't necessarily have to clear your console window, you can just use ncurses or send escape codes to your terminal for it to move the cursor
@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!
@SwirlOfColors
@SwirlOfColors 9 жыл бұрын
The talk - What programming is never about - he mentions is here: kzbin.info/www/bejne/gqvGZHuZfsyLn9U
@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.
@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?
@GendoIkari
@GendoIkari 5 жыл бұрын
OMG you worked on thief!!
@EvanTeran
@EvanTeran 9 жыл бұрын
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 жыл бұрын
Because everyone does this, everyone uses a slightly different subset of C++, which makes maintaining C++ code a nightmare
@EvanTeran
@EvanTeran 7 жыл бұрын
@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 жыл бұрын
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 жыл бұрын
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 жыл бұрын
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.
@pierce8308
@pierce8308 4 жыл бұрын
omg that 1999 visual studio is so sick compared to the versions now. sucks i cant find the version online
@sw97058
@sw97058 3 жыл бұрын
I just use VSCode and turn most stuff off
@fullcyber
@fullcyber 3 жыл бұрын
vs 6 is available on the-eye[dot]eu in the msdn archive
@naikrovek
@naikrovek 9 жыл бұрын
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 жыл бұрын
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 жыл бұрын
naikrovek Totally agree. They should have written Linux in Python.
@naikrovek
@naikrovek 9 жыл бұрын
***** yes. That is EXACTLY what I said.
@unclelindsey2068
@unclelindsey2068 9 жыл бұрын
Sarcasm.
@GeorgeTsiros
@GeorgeTsiros 7 жыл бұрын
sooo because the openSSL devs did not do proper argument checking, it's somehow C's fault?
@5Gazto
@5Gazto 7 жыл бұрын
I like how he uses HTML to say "Fuck you!" to overly priced presentation programs.
@atilafernandes217
@atilafernandes217 3 жыл бұрын
[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]
@Ancipital_
@Ancipital_ 2 ай бұрын
Old Windows UI is superior to modern Windows
@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?
@zawizarudo7295
@zawizarudo7295 Жыл бұрын
visual c++
@skeleton_craftGaming
@skeleton_craftGaming Жыл бұрын
Yes, visual studio has gotten significantly better since then. Like it is now one of the best IDEs I know of
@rusi6219
@rusi6219 4 ай бұрын
If you have at least 16 GB ram lol
@skeleton_craftGaming
@skeleton_craftGaming 4 ай бұрын
@@rusi6219no developer is buying a computer with less than 16 GB of RAM, because they don't make computers with that little ram that have the type of processors we need.
@aaronoman6460
@aaronoman6460 9 жыл бұрын
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)"
@Necrometr
@Necrometr 4 жыл бұрын
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 4 жыл бұрын
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.
@ryonagana
@ryonagana 4 жыл бұрын
a question do you recommend using C for gamedev instead C++?
@johnjackson9767
@johnjackson9767 4 жыл бұрын
I certainly do.
@hellboy6507
@hellboy6507 4 жыл бұрын
Is recommend C++ if you know how to to use its better features.
@Mateus.007
@Mateus.007 4 жыл бұрын
@@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 жыл бұрын
Their comments are biased, ma'am
@MrAbrazildo
@MrAbrazildo 3 жыл бұрын
C++ is the best, even more for games.
@AleksyGrabovski
@AleksyGrabovski 2 жыл бұрын
Thanks for you lib and good stream. I'll consider stb in a professional work.
@ryonagana
@ryonagana 4 жыл бұрын
visual c++ 6.0 (98) on background cool!
@CarlJohnson-jj9ic
@CarlJohnson-jj9ic 4 жыл бұрын
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.
@GeorgeTsiros
@GeorgeTsiros 7 жыл бұрын
42:50 omg he laughed :D
@Gubber
@Gubber 9 жыл бұрын
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.
@xbz24
@xbz24 Жыл бұрын
Testing testing…
@nac9880
@nac9880 4 жыл бұрын
That's the longest advice ever
@rul1175
@rul1175 Ай бұрын
is he running windows 95???
@SeanTBarrett
@SeanTBarrett Ай бұрын
Windows 7
@skeleton_craftGaming
@skeleton_craftGaming Жыл бұрын
The best replacement for the standard c library, and this is going to be controversial, is C++'s standard template library
@Levelworm
@Levelworm 4 жыл бұрын
Is that actually Visual C++ 6.0?
@SeanTBarrett
@SeanTBarrett 4 жыл бұрын
kzbin.info/www/bejne/aXO8fJyFfcl2hMk
@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!
@MrAbrazildo
@MrAbrazildo 3 жыл бұрын
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 3 жыл бұрын
You can do even better in Rust. C++ is a sinking ship full of bloat and bs
@MrAbrazildo
@MrAbrazildo 3 жыл бұрын
@@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 жыл бұрын
"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?
@the_original_dude
@the_original_dude Жыл бұрын
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.
@SeanTBarrett
@SeanTBarrett Жыл бұрын
yawn
@mvargasmoran
@mvargasmoran 3 жыл бұрын
49:08 what the hell...
@Kenbomp
@Kenbomp 4 жыл бұрын
As long as you're not making window GUI programming windows in c is fine..
@JelloTalks
@JelloTalks 4 жыл бұрын
'Advice for Writing Small Programs in C' 1:45:23 Yup, thats C all right
@typon1
@typon1 4 жыл бұрын
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 жыл бұрын
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 Жыл бұрын
Would trust Sean’s C code over any code you wrote in any other language.
@skeleton_craftGaming
@skeleton_craftGaming Жыл бұрын
11:33 That didn't age well , of the three major game engines with available source All of them are written in C++..
@stephenkamenar
@stephenkamenar 4 жыл бұрын
have you heard of JAVASCRIPT?
@32gigs96
@32gigs96 4 жыл бұрын
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.
@ryanalnaser914
@ryanalnaser914 2 жыл бұрын
islam
History and Spirit of C - Olve Maudal
42:01
NDC Conferences
Рет қаралды 11 М.
2 Years Of Learning C | Prime Reacts
22:24
ThePrimeTime
Рет қаралды 304 М.
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 50 МЛН
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts (PixelRifts)
Рет қаралды 91 М.
Andrew Kelley   Practical Data Oriented Design (DoD)
46:40
ChimiChanga
Рет қаралды 127 М.
Advanced C: The UB and optimizations that trick good programmers.
1:12:34
Eskil Steenberg
Рет қаралды 173 М.
Let's Create a Compiler (Pt.1)
1:11:03
Pixeled
Рет қаралды 547 М.
"New" Features in C - Dan Saks
59:52
NDC Conferences
Рет қаралды 121 М.
Modern C and What We Can Learn From It - Luca Sas [ ACCU 2021 ]
1:05:59
ACCU Conference
Рет қаралды 104 М.
Where Does Bad Code Come From?
42:21
Molly Rocket
Рет қаралды 199 М.
Rust: When C Code Isn't Enough
8:26
CodeAhead
Рет қаралды 172 М.
I regret doing this...
1:20:07
Tsoding Daily
Рет қаралды 82 М.
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 50 МЛН