How To Quickly Generate C Prototype Functions in VSCode
How To Quickly Generate C Prototype Functions in VSCode
How To Quickly Generate C Prototype Functions in VSCode
com/)
/) Blog (https://www.ohsat.com
Home (https://www.ohsat.com /post/)
/game/)
Games (https://www.ohsat.com
Tutorials (https://www.ohsat.c
om/tutorial/)
/staticpage/about/)
About (https://www.ohsat.com
NOTE:
This tutorial is most likely not compatible with versions of SGDK above 1.70. Unfortunately, I
simply do not have the capacity or ability to update them right now. Read more about it here
(https://www.ohsat.com/post/about-the-sgdk-tutorials/). Sorry.
Ninja Time!
If you like 90s platformers, check out my new game Chibi Ninja Shino-kun
(https://www.ohsat.com/game/shino-kun)!
(https://www.ohsat.com/game/shino-kun)
(https://www.ohsat.com/game/shino-kun)
One of the cool things that VSCode offers is the support for extensions. And there are a ton of them. There’s pretty
much one for every occasion, and if there isn’t, there probably will be soon. And since we use C, an absolute classic
of a programming language, there are also some that can help us out with Mega Drive coding!
Today I wanted to show off a small but really useful extension: C Auto Prototypes
(https://marketplace.visualstudio.com/items?itemName=Molitany.c-auto-prototypes).
Implicit function declarations in C can be tricky. They can cause issues, might prevent the program from compiling
completely, or will at least flood your output console with tons of warnings. The obvious approach would be to sort
the functions in the order they’re used, but that’s not just a ton of work, it often straight up isn’t possible. Function
prototypes are therefore a way better solution to this issue. They tell the compiler about the parameters and return
type of a function before its body is ever defined. However, that means you’ll have to add a prototype for every
function…and if you change the parameters or the return type of a function, you’ll have to change the prototype as
well. That’s a lot of extra work, and it’s also very easy to forget. This is where the extension comes in.
The C Auto Prototypes extension generates prototypes for all functions in your program at the press of a button!
Well, at the press of three buttons. Simply press the shortcut Alt + Shift + Q and the extension will scan all the
functions defined after main() and add their prototypes above main() . It’s important to note that it will do this for
functions defined after the main function! But that’s not all: If you ever change one of the functions, simply press
Alt + Shift + Q again and C Auto Prototypes will update the existing prototypes to reflect the changes. It’s
simple, quick and very efficient.
You can get the extension from the Visual Studio marketplace (https://marketplace.visualstudio.com/items?
itemName=Molitany.c-auto-prototypes).
Do you know of any other VSCode extensions that could be handy for Mega Drive programming? Let me know in the
comments below!
If you've got problems or questions, join the official SGDK Discord (https://discord.gg/xmnBWQS)! It's full of people a
lot smarter and skilled than me. Of course you're also welcome to just hang out and have fun!
Email Subscribe
No soy un robot
reCAPTCHA
Privacidad - Condiciones
(Check your spam folder if you don't get the confirmation mail)
Powered by CleverReach (https://www.cleverreach.com/?
utm_source=system&utm_medium=form&utm_campaign=c172068). I won't send you spam or sell/give your email
address to someone else. You can unsubscribe (https://seu2.cleverreach.com/f/172068-168929/wwu/) at any time.
By clicking the subscribe button above, you confirm that you have read and agreed to the privacy policy
(http://www.ohsat.com/staticpage/privacy-policy/).
(https://www.patreon.com/ohsat)