On C programming, switch-cases and the GOSUB

  Рет қаралды 32,009

Bisqwit

Bisqwit

Күн бұрын

Пікірлер: 81
@jimgao1068
@jimgao1068 9 жыл бұрын
Man, you are an excellent teacher. You don't just stop at concepts of computer science, but you explain things from a different perspective, like psychology, and essentially how human works. Good job!
@Bisqwit
@Bisqwit 9 жыл бұрын
Jim Gao Thank you very much!
@hectorboone4662
@hectorboone4662 3 жыл бұрын
I guess it is kinda off topic but do anyone know of a good site to watch newly released tv shows online ?
@mikamulperi
@mikamulperi 3 жыл бұрын
@@hectorboone4662 LOL
@Tupster
@Tupster 10 жыл бұрын
Your coding skills earn you me respect but your philosophy gives me a huge bro-crush.
@Louthsk8er
@Louthsk8er 10 жыл бұрын
Very good advice, I agree with you that programming can be an art form. Programming has also taught me to think differently. Ever since I started programming, when I see something interesting I also try to imagine how it works, and how I could make something similar to it.
@Bisqwit
@Bisqwit 10 жыл бұрын
That way of thinking is not limited to programmers, but engineers in general :-) Thanks for the post!
@redchards
@redchards 10 жыл бұрын
It's cool to see someone enjoying finding tricks and sharing it :=) Keep on working, that's truly great !
@NonTwinBrothers
@NonTwinBrothers 2 жыл бұрын
Woaah, was not expecting that message at the end. A very nice perspective!
@mscott3564
@mscott3564 10 жыл бұрын
beautiful argument for programming as an art, I agree entirely
@darkofruk4584
@darkofruk4584 10 жыл бұрын
Nice tutorial, i always watch your videos when want to find something what didn't know before. You make video with most complex topics in programming, and maybe you are most complete programmer in world .... anyway thnx for sharing your knowledge with rest of the world :) .... didn't know that youtube makes 2160 resolution ...
@lookupverazhou8599
@lookupverazhou8599 2 жыл бұрын
You're one of the few people on youtube, or anywhere for that matter, whom I actually subscribe to and take the time to leave a like.
@vitstepanek2308
@vitstepanek2308 10 жыл бұрын
"Don't forget to Go Sub my channel" haha i see what u did there :D
@MA-nx3xj
@MA-nx3xj 3 жыл бұрын
Fantastic message to all programmers/coders!
@HowManySystems
@HowManySystems 10 жыл бұрын
Awesome video, Awesome wallpaper. What is this music?? Why is everything so perfect here?
@Bisqwit
@Bisqwit 10 жыл бұрын
Thanks! The music is Light Fantasy field theme 2, converted into a MIDI and played through OPL3 emulation both with custom tools I made.
@darkdevil905
@darkdevil905 10 жыл бұрын
You're an inspiration & definitely an excellent teacher !
@Bisqwit
@Bisqwit 10 жыл бұрын
Thank you! I hope to do more.
@yoowon-hye9270
@yoowon-hye9270 4 жыл бұрын
Came here for a programming tutorial, received enlightenment instead 😂😂 Btw tho this video's a bit old already but I have learned so much just by watching this. Thank you
@AugustusCeasar12
@AugustusCeasar12 10 жыл бұрын
This is quite the interesting subject! Thank you for sharing it with us.
@khalidm5939
@khalidm5939 8 жыл бұрын
Learned a lot from this video keep up the good work! wish I seen these videos earlier lol.
@luckysinghlodhi1439
@luckysinghlodhi1439 4 жыл бұрын
Why i can't use char ** as array of strings in mingw gcc compiler(code::blocks c) ? Please tell me sir?
@Bisqwit
@Bisqwit 4 жыл бұрын
Because it’s not an array of strings to begin with. It is a pointer to (zero or more of) pointer to (zero or more of) char. You can use it _to access_ an array of pointers to (zero or more of) char, and treat those pointers as strings, i.e. an array of strings, but it _is not_ an array of strings, just like a telephone is not your friend, even though you can use it to talk with your friend.
@luckysinghlodhi1439
@luckysinghlodhi1439 4 жыл бұрын
@@Bisqwit but that's not working in code::blocks ide. Why?
@Bisqwit
@Bisqwit 4 жыл бұрын
Please describe the symptoms of it “not working”.
@luckysinghlodhi1439
@luckysinghlodhi1439 4 жыл бұрын
@@Bisqwit memory overload after running program
@Bisqwit
@Bisqwit 4 жыл бұрын
There is some sort of error in your program. That is as specific response as I can give to you, with the information you have given so far. Again, I remind you of my first reply: char** _is not_ an array of strings. It is NOT an array of strings. Do not use it as if it were an array of strings. It is NOT an array of strings. It is something that you can use to REFER to an array of strings, but it is NOT an array of strings. To REFER to an array of strings, said array has to exist somewhere. The char** IS NOT the array of strings. IF YOU USE IT as if were an array of strings, your program will NOT WORK properly. I am repeating because you obviously did not register what I wrote in my first post. The char** IS NOT an array of strings. It is just a pointer to one, a way to access it. Much like a telephone is not your friend. You can use a telephone to talk with your friends, but a telephone is NOT the friend. A pointer is just a thing that you can use to refer to something _that exists somewhere else._
@lukeword9401
@lukeword9401 8 жыл бұрын
Where did you get that shimeji/ desktop buddy? I've been looking for something like that on linux for a while now.
@Bisqwit
@Bisqwit 8 жыл бұрын
+Luke Word Macopix. Though it is found conveniently in Debian, I usually download and install it straight from this page, from which you can also download the mascots (graphics + ini script) used by the program. rosegray.sakura.ne.jp/macopix/index-e.html
@lukeword9401
@lukeword9401 8 жыл бұрын
Bisqwit Thanks!
@Vitis-n2v
@Vitis-n2v 10 жыл бұрын
I still don't get 3:17 the stk.push(&&n); what is &&n i only know that &n would be address of n but what is &&n?
@Bisqwit
@Bisqwit 10 жыл бұрын
&&label is a GNU extension which takes the address of a goto label and produces a void* pointer. It is neither standard C nor standard C++. The double-& is there because &label would not work. &n only works when n is an expression. Labels are not expressions: They do not have a value. You can't pass labels as function parameters, nor can you print them, compare them, or use them in arithmetic expressions. The GNU extension, unary && operator, turns the label into an actual expression of type void*.
@Veso266
@Veso266 6 жыл бұрын
just wondering, how do you write GUI in Pascal was there a designer in Turbo pascal that would allow you to design your GUI?
@Bisqwit
@Bisqwit 6 жыл бұрын
There was no designer in the text-mode versions. In the Windows versions there was a designer but I never used it (in fact, I still have hardly ever created GUI programs). In the text-mode versions, you would write coordinates by hand. Example (from tvdemo.pas), this creates a dialog box: function CreateFindDialog: PDialog; var D: PDialog; Control: PView; ChkBox : PView; R: TRect; begin R.Assign(0, 0, 65, 9); D := New(PDialog, Init(R, 'Find')); with D^ do begin Options := Options or ofCentered; R.Assign(16, 2, 60, 3); Control := New(PInputLine, Init(R, 80)); Insert(Control); R.Assign(2, 2, 15, 3); Insert(New(PLabel, Init(R, '~T~ext to find', Control))); R.Assign(60, 2, 63, 3); Insert(New(PHistory, Init(R, PInputLine(Control), 10))); R.Assign(3, 5, 35, 7); ChkBox := New(PCheckBoxes, Init(R, NewSItem('~C~ase sensitive', NewSItem('~W~hole words only', nil)))); Insert(ChkBox); R.Assign(2, 4, 15, 5); Insert(New(PLabel, Init(R, 'Options', ChkBox))); R.Assign(42, 4, 55, 6); Insert(New(PButton, Init(R, '~PANIC~!!', cmPanic, bfNormal))); R.Assign(38, 6, 48, 8); Insert(New(PButton, Init(R, 'O~K', cmOk, bfDefault))); Inc(R.A.X, 12); Inc(R.B.X, 12); Insert(New(PButton, Init(R, 'Cancel', cmCancel, bfNormal))); SelectNext(False); End; CreateFindDialog := D; End;
@Veso266
@Veso266 6 жыл бұрын
nice
@mikaelmoizt
@mikaelmoizt 10 жыл бұрын
Very interesting. Are you coding 6502 assembler aswell? Or RP2A07 assembler to be more specific?
@Bisqwit
@Bisqwit 10 жыл бұрын
I do. The one on the background is a cheap clone, though.
@qrplife
@qrplife 4 жыл бұрын
“Don’t forget to go sub my channel.” - I see what you did there!
@DonnysRealm
@DonnysRealm 10 жыл бұрын
Very informational, thank you
@Samuelfodao
@Samuelfodao 8 жыл бұрын
Where can I find your editor that you created? sorry, my english isn't very good ;)
@Bisqwit
@Bisqwit 8 жыл бұрын
In *this* video you see actually Joe (joe-editor.sourceforge.net/). The editor that I created runs only in 16-bit DOS. It can be downloaded e.g. here: bisqwit.iki.fi/jutut/kuvat/programming_examples/cpp_thread_tutorial/ But it only runs in 16-bit DOS and is limited to small files.
@Samuelfodao
@Samuelfodao 8 жыл бұрын
+Bisqwit Thank u very much! :)
@tersbersirs
@tersbersirs 10 жыл бұрын
Just a simple question. Is it necessary to learn the Discrete Math before you can start to programming?
@Bisqwit
@Bisqwit 10 жыл бұрын
I had to look up that term. So, to answer your question: Not at all. But arithmetic skills in general do help a lot, and for some topics, conversions between different numeric bases (decimal, binary, hexadecimal) are required. For 3D graphics, vector mathematics are absolutely necessary. For some optimization tasks, it helps to know integration. And so on. To have fun with programming? As long as you can divide 200 by 4 in your head and get 50, you are fine.
@tersbersirs
@tersbersirs 10 жыл бұрын
Thank you for your quick reply and detailed explanation. I'm learning the Theory Automata which is a branch of the Discrete Math that could be necessary and could help me to create a high quality algorithms and then written code, my first programming language will be C. Anyway, I love math and everything that related to.
@vittorioromeo1
@vittorioromeo1 10 жыл бұрын
Very interesting, as always :)
@nileshgopnarayan4464
@nileshgopnarayan4464 3 жыл бұрын
Why donot you start online classes ?
@Bisqwit
@Bisqwit 3 жыл бұрын
Too small return on investment. For something that may or may not return any money, I would rather do something for free. That way, nobody can make demands.
@AcceleratingUniverse
@AcceleratingUniverse 8 жыл бұрын
Do you have a link to your anime girl window topper? I need an anime girl in my life
@Bisqwit
@Bisqwit 8 жыл бұрын
rosegray.sakura.ne.jp/macopix/index-e.html
@AcceleratingUniverse
@AcceleratingUniverse 8 жыл бұрын
Thank you, this is so cool
@jamz3243
@jamz3243 4 жыл бұрын
very nice video.
@mdev790
@mdev790 3 жыл бұрын
What's the font?
@Bisqwit
@Bisqwit 3 жыл бұрын
Answered in: kzbin.info/www/bejne/q3q3oYFjhL-Wq9E
@Trunkerad
@Trunkerad 10 жыл бұрын
The BASIC program at the end feels very Scorched Earth. Is that the original inspiration?
@Bisqwit
@Bisqwit 10 жыл бұрын
Yes, Scorched Earth was the original inspiration.
@Sturmtreiben
@Sturmtreiben 10 жыл бұрын
Great - thank you!
@milltonmanakeeper53
@milltonmanakeeper53 8 жыл бұрын
Hey Bisqwit me again with my killer questions! I wouldn't bother you if I could find an answer for my question in the internet but as I wasn't able to, you are the most reliable source I have. Anyways, is it possible to directly acces the hardware using C like changing the pixels on the screen, limiting the CPU frequency, recording or watching the webcam? If so how? I think that pixels would be controlled via data like most thing electronic and by changing the data accordingly it is possible to manipulate hardware. Well that's a pretty long comment so if you don't feel like answering, I can relate to that but in that case at least a reply to let me know if you won't answer would be good so I don't wait for an answer.
@Bisqwit
@Bisqwit 8 жыл бұрын
The answer is it really depends on the hardware (less) and on the operating system (more). Nearly all modern operating systems employ a scheme called "memory protection", which is a bit of a misnomer because it not only affects memory, but also hardware resources. What this means is that operating system protects hardware resources and memory resources of other application programs from being tampered with by application programs. Under these constraints, accessing hardware resources, like the CPU frequency, or the pixels on the screen, is possible with two venues only: A) using the facilities that your operating system gives you, such as library calls, device driver interfaces, and so on; and B) gaining elevated privileges, bypassing the security protections. However, if you bypass the security and access the hardware directly, you may end up fighting with the operating system that also wants to manage the same resource, with potential consequences including a system crash. There is nothing in C language itself that makes it possible or impossible. In fact, Linux kernel is nearly 100 % written in C. Did you know its source code is freely available? P.S. I still wonder what happened to the question you posted about programming a MS-DOS-like OS. I replied to it, and then it disappeared. Did you delete it?
@milltonmanakeeper53
@milltonmanakeeper53 8 жыл бұрын
+Bisqwit Thank you!
@FinnT730
@FinnT730 8 жыл бұрын
Please don't say you are bad at English! You are good at it!
@Bisqwit
@Bisqwit 8 жыл бұрын
I'm not bad at the language -- vocabulary, grammar and so on. Just the pronounciation of it.
@FinnT730
@FinnT730 8 жыл бұрын
Bisqwit Oh, ok!
@multicoloredwiz
@multicoloredwiz 10 жыл бұрын
I exhaled vigorously at the last sentence :)
@milasudril
@milasudril 5 жыл бұрын
Coroutines?
@happyman_smiling
@happyman_smiling 6 жыл бұрын
Bisquit what are your views about rust programming language.
@Bisqwit
@Bisqwit 6 жыл бұрын
Pretty much the same as the last time you asked the same question.
@jessicaNya
@jessicaNya 10 жыл бұрын
Is like Bob Ross and The Joy of Programming. I don't think you need to worry about your voice.
@Claudiox360
@Claudiox360 7 жыл бұрын
So after just ONE year he started programming, he was able to create such a program (1:16) ? How is this possible ? o_o
@Bisqwit
@Bisqwit 7 жыл бұрын
It did not look as pretty and concise as the code on screen; I edited it for the video. But functionally it was the same. Creating and dropping dirt.
@imkow
@imkow 8 жыл бұрын
imho, is it more likely that GOSUB can be replaced with a function(, a predefined macro, an inline function in C++, or a SUB in QuickBASIC etc),isn't it. since QB era of 90s i read from my beginner books that GOSUBs and gotos are relics from the assembly languages..the new syntax of QuickBasic was one of first examples for the newly invented "structured programming", which is best known for it's total abandon of the use of Gotos ...It's been in my mind the "goto" thing is evil or counter-revolutionary to the evolution of programming languages :D....But i've also noticed this video may have been intended to preserve this workaround for GOSUB as an inspiring C trick...now im ok with both practices......
@Bisqwit
@Bisqwit 8 жыл бұрын
+imkow GOSUB and RETURN are indeed the low-level equivalents of a function call, and the high-level equivalents of call/jsr and ret/rts in assembly. However, functions are restricted to a certain rigid structure, which the lower level equivalents are free of.
@abhishekkadam2999
@abhishekkadam2999 5 жыл бұрын
That was *Enlightenment
@meithecatte8492
@meithecatte8492 7 жыл бұрын
But why do so when the C language includes functions already?
@Bisqwit
@Bisqwit 7 жыл бұрын
I explained the rationale from 5:14 onwards.
@bjzaba
@bjzaba 10 жыл бұрын
Awesome stuff! Posted it on reddit: www.reddit.com/r/programming/comments/22ubfg/on_c_programming_switchcases_and_the_gosub/
@Bisqwit
@Bisqwit 10 жыл бұрын
Thanks! Including my upvote and yours it seems to be at 0 points currently. Not doing too well.
How Bisqwit makes programming videos [screencast / C++14]
11:54
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Comparing C to machine language
10:02
Ben Eater
Рет қаралды 5 МЛН
Creating a DCPU-16 emulator in C++11
35:27
Bisqwit
Рет қаралды 54 М.
I wrote a Raytracer for DOS, 16 VGA colors
15:00
Bisqwit
Рет қаралды 897 М.
Creating a Chip8 interpreter/emulator in C++14
10:51
Bisqwit
Рет қаралды 112 М.
What are EXE files made of?
11:00
Bisqwit
Рет қаралды 146 М.
Programming Arduino in C++11 -- ROM dumping
22:24
Bisqwit
Рет қаралды 46 М.
Creating a Doom-style 3D engine in C
18:50
Bisqwit
Рет қаралды 963 М.
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН