View Single Post
Old 26th May 2009
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

FreeBSD system call number 136 is the one for int mkdir(const char *, mode_t); which is a UNIXism, or more likely an 'ism from whoever they stole it form and eventually adapted to C lol. I chose to refer to it like that, as an example (and curious if anyone would look it up and see it crystal clear).


My point being. mkdir() is an OS specific system call -- both its presence, system call number, calling convention, behaviour, and above all..... What says that your code is running on a computer that has access to a file system in the first place, let along that said file system must implement the directories concept at all ;-). Directories/Folders are a universally simple and in the modern world, very a portable concept. Actually doing anything fun with them is non portable, and likely to be extremely so if you want to write portable code - because it might just find itself on a directory less file system, let along a mkdir()'less environment. This is why perl mkdir() or python os.mkdir() are fairly portable for unix/windows/most os, but doing it in C is not as much fun.


Now if something that simple is inherently non-portable, can anyone really expect implementing something as complex as X11R7 to be? Especially when you consider that while old mkdir() will be there in any Unix C API (and standardized), so it might not sound like a big deal: but can the same be said of accessing display or graphics hardware through system APIs? POSIX doesn't get into a lot of that stuff because it is outside the intended scope, much like what is needed to write a screen saver is beyond the scope of C99s need to be portable. You can write a screen saver that is valid C99 code, but you writing a portable screen saver is a bit harder



Before starting work on my star fighter game, I needed to solve very non portable issues -> graphics, keyboard/mouse, and audio access. Now it is fair to say, you must have a mouse or a keyboard to use my game, but it is fair to say: you must have the same mouse I do, since I don't care to write code for yours? As your statement (which I very very highly agree with Oko) might suggest, for me the only viable solution was to use a portable interface as much as possible, and make that the requirement rather then something very specific to the system. For me the choice was a no brainer named SDL. If SDL don't work well enough for someones needs, well that's not my problemo... hehe .
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote