why C

Posts that don't fit in the other forums
Post Reply
Posts: 13
Joined: Sat Nov 29, 2014 3:07 am

why C

Post by capz » Tue Dec 09, 2014 6:09 am

So I have a background in C++, but a professional indie game developer who has been in the field for years used to teach me programming. He was always using mixed C and C++, using just the bits he needed of the C++ language to get the job done.

That was probably 8 or more years ago, but now I find myself playing with handheld hardware again, and have found that most code for the 3ds/libctru is in fact in C. So I was wondering if there is any good reason to go out of my way to write in C as opposed to C++?

Posts: 355
Joined: Thu Jul 02, 2009 1:19 pm

Re: why C

Post by elhobbs » Wed Dec 10, 2014 5:29 pm

for the 3ds I do not think that it really matters. I think the issue is primarily aimed at more resource constrained devices like the gba or even the ds - be that limited amounts of ram or memory access issues, like not having byte addressable memory for certain regions. I suspect the libraries are in C as it will work with both C and C++ rather easily. I would also imagine that it is easier considering that they are building this as they reverse engineer the device - just my opinion though.

Site Admin
Posts: 1478
Joined: Tue Aug 09, 2005 3:21 am
Location: UK

Re: why C

Post by WinterMute » Sun Dec 14, 2014 12:55 am

Keeping the libraries in C means that developers aren't forced to use C++ while still working equally well for those who want to write C++. It's really no more complicated than that.

Just bear in mind that the libraries are statically linked and STL code can get very large, very quickly. http://www.coranac.com/2009/02/some-int ... code-size/ might be of interest.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests