Skip to main content
GameDev.net gamedev.net
🔒 Locked

C-RunTime library with C++

Started by null_pointer Mar 23, 2000 at 5:07 PM 9 replies 850+ views
Original Post
null_pointer
null_pointer
I''ve run across several different functions that seem to do the same thing, like fopen() and open(), etc. and also functions that are similar to Win32 API functions. Why are they there? Does the entire run-time library function independently of an OS? If not, what parts (if any) are standard to ANSI C++? Also, how does programming in OSes other than Windows differ from programming in Windows? Thanks in advance! - null_pointer
SiCrane
SiCrane
Most of the C runtime library functions are implemented as calls to Windows apps on windows platforms. They are standard functions that you can expect on all platforms when compiling C. It may be redundant, but it makes compatability easier. Again, it doesn''t function independently of the OS. Any function declared is stdio.h, stdlib.h, math.h (and many others that I''m too lazy to look up) should be found on any C development system.

Basic C apps compile the same in all OS''s. Once you throw in a GUI and graphics it becomes a horrible, horrible mess from platform to platform.
null_pointer
null_pointer
So, _beginthread and _endthread both function the same on any C platform? Even DOS? And when it says, "Compatibility: Windows 95, Windows NT", that means it works on all platforms, but the docs are only for Win95 and NT? I don''t understand this at all.

Thanks!


- null_pointer
mordell
mordell


No. At least I don''t interpret it that way.

_beginthread and _endthread will only work on Microsoft platforms Win9x and NT ( essentially WIN32 ).

If it is ANSI compatible, meaning that it will likely work with another vendors compiler and platform, it will be listed as such in the documentation under "Compatibility". e.g. Compatibility: ANSI, Win95, WinNT

Of course, this is from a guy who has never had to program for another platform besides Windows in his life!



-mordell




__________________________________________

Yeah, sure... we are laughing WITH you ...
SiCrane
SiCrane
quote:
Original post by null_pointer
So, _beginthread and _endthread both function the same on any C platform? Even DOS? And when it says, "Compatibility: Windows 95, Windows NT", that means it works on all platforms, but the docs are only for Win95 and NT? I don''t understand this at all.



_beginthread() is in process.h, which *isn''t* one of the portable header files.
null_pointer
null_pointer
SiCrane: (I asked because I didn''t know (and what''s a portable header anyway?))

Thanks, everyone!


- null_pointer
SiCrane
SiCrane
Here are the library files defined by the ANSI C standard:
assert.h, ctype.h, errno.h, float.h, limits.h, math.h, setjmp.h, signal.h, stdargs.h, stddef.h, stdio.h, stdlib.h, string.h and time.h.

Essentially any function in any of those header files should be available on any platform.
null_pointer
null_pointer
Thanks, SiCrane (and mordell too)!! I guess my questions were not specific enough at first


- null_pointer
Kylotan
Kylotan
I believe that any function that starts with an underscore is specific to that particular implementation, and not standard ANSI C. In most cases it means the function is not available on all platforms.
null_pointer
null_pointer
Kylotan: I thought that functions, variables, keywords etc. with one underscore were reserved for the language, while two underscores indicate a compiler specific function, variable, keyword, etc. Thanks, anyway!

Thanks!


- null_pointer
Kylotan
Kylotan
quote:
Original post by null_pointer

Kylotan: I thought that functions, variables, keywords etc. with one underscore were reserved for the language, while two underscores indicate a compiler specific function, variable, keyword, etc. Thanks, anyway!



You are probably right: I can''t find the standard anywhere to check exactly. I think it does signify that it can differ from one implementation to another. I read somewhere that it would be unwise to rely on such functions if portability was desired.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.