Page 1 of 1

why C

Posted: Tue Dec 09, 2014 6:09 am
by capz
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++?

Re: why C

Posted: Wed Dec 10, 2014 5:29 pm
by elhobbs
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.

Re: why C

Posted: Sun Dec 14, 2014 12:55 am
by WinterMute
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. ... code-size/ might be of interest.