• Programming: C
    112 replies, posted
[QUOTE=esalaka;22845488]MinGW + MSYS. I used that combination on Windows and it worked just fine. (MSYS includes windows versions of basic *NIX tools like bash, grep, find, ls etc.)[/QUOTE] Installing msysgit can make it even easier. Open a bash prompt anywhere you can right-click on a folder :D
[QUOTE=Chandler;22845936]Installing msysgit can make it even easier. Open a bash prompt anywhere you can right-click on a folder :D[/QUOTE] Well, I suppose. Although I actually setup msysgit so that I could use it from my main MSYS installation :D
[QUOTE=blankthemuffin;22844494]Or you could just install MingW / CodeBlocks. Compiling C with a C++ compiler defeats half the point of using C.[/QUOTE] Sorry, I meant to add a bit to the end, explaining that I was cynically paraphrasing microsoft support. Basically a while back I had to port a project over to windows using VC++. I hit some problems because some of the included third party code had C99 standard stuff in it, and the compiler was shouting at me for declaring variables in the middle of my code, etc. The best answer I could find was: "use C++" Sums up microsoft pretty well. "Of course you can do what you want, but seeing as our way is better we'll only pretend to help you"
You have to declare variables at the beginning of the scope in C.
[QUOTE=RyanPridgeon;22851004]You have to declare variables at the beginning of the scope in C.[/QUOTE] [url]http://en.wikipedia.org/wiki/C99[/url]
Well, I'm a linux guy.
[QUOTE=snuwoods;22852457]Well, I'm a linux guy.[/QUOTE] You forgot to add "Your argument is invalid"
[QUOTE=snuwoods;22852457]Well, I'm a linux guy.[/QUOTE] So? Most if not all of that Linux kernal you use is written in C.
Why exactly are operating system kernels debugged with C and not C++. //Never mind that one. bad reading Windows XP (don't know about the other ones) is built with C++...
[QUOTE=Woodcutter11;22854814]Why exactly are operating system kernels debugged with C and not C++. //Never mind that one. bad reading Windows XP (don't know about the other ones) is built with C++...[/QUOTE] What are you talking about, the NT kernel is written in C? [editline]10:53PM[/editline] And they're mostly written in C because C is quite a lot more low-level than C++.
[QUOTE=esalaka;22855894]What are you talking about, the NT kernel is written in C? [editline]10:53PM[/editline] And they're mostly written in C because C is quite a lot more low-level than C++.[/QUOTE] But i heard somewhere that Windows XP was written in C++ :aaa:
Well you heard wrong.
[url=http://www.haiku-os.org/]Haiku OS[/url] was written entirely in C++. It's also fast as hell.
[QUOTE=Chandler;22863266][url=http://www.haiku-os.org/]Haiku OS[/url] was written entirely in C++. It's also fast as hell.[/QUOTE] It'd probably be twice as fast and twice as easy to work with if they didn't write it in C++. :P
[QUOTE=blankthemuffin;22865536]It'd probably be twice as fast and twice as easy to work with if they didn't write it in C++. :P[/QUOTE] I don't think you understand how dumb your statement is. [editline]11:26PM[/editline] [QUOTE=esalaka;22855894] And they're mostly written in C because C is quite a lot more low-level than C++.[/QUOTE] Considering 99% of C can be compiled as C++, C is *not* more low-level than C++. (Though, C++ does have some higher level utilities for use.)
[QUOTE=nullsquared;22865624]I don't think you understand how dumb your statement is. [editline]11:26PM[/editline] Considering 99% of C can be compiled as C++, C is *not* more low-level than C++. (Though, C++ does have some higher level utilities for use.)[/QUOTE] Right back at you lol.
[QUOTE=Woodcutter11;22858112]But i heard somewhere that Windows XP was written in C++ :aaa:[/QUOTE] Well the tools might be (setup screens, dhcp client, etc) but the kernel is C.
[QUOTE=nullsquared;22865624]I don't think you understand how dumb your statement is. [editline]11:26PM[/editline] Considering 99% of C can be compiled as C++, C is *not* more low-level than C++. (Though, C++ does have some higher level utilities for use.)[/QUOTE] C++ is not a superset of C. "99%" is hilarious, considering most C compilers won't even compile 99% of the C99 standard! [editline]01:36AM[/editline] The GNU C compiler will compile ~90% of it.
[QUOTE=Jawalt;22867762]The GNU C compiler will compile ~90% of it.[/QUOTE] So uh, I'd like to see some proof of that. What bits of C99 does GCC miss?
[QUOTE=blankthemuffin;22867976]So uh, I'd like to see some proof of that. What bits of C99 does GCC miss?[/QUOTE] [url]http://gcc.gnu.org/c99status.html[/url] BOOM for more recent info [url]http://gcc.gnu.org/gcc-4.5/c99status.html[/url]
I thought that was pretty common knowledge. Give them a break, it's only been out for 11 years. You can't expect these sort of things overnight.
Who knows how long it'll take them to implement [url=http://en.wikipedia.org/wiki/C1X]C1X[/url]
By then we'll all be using clang anyway. :P I wonder if it'll be anything like C++5x... (edited for projected release date)
[QUOTE=blankthemuffin;22870625]By then we'll all be using clang anyway. :P I wonder if it'll be anything like C++5x... (edited for projected release date)[/QUOTE] guffaw Chances are it'll be called C++11, since they entered their final draft back in May.
[QUOTE=nullsquared;22865624]I don't think you understand how dumb your statement is. [editline]11:26PM[/editline] Considering 99% of C can be compiled as C++, C is *not* more low-level than C++. (Though, C++ does have some higher level utilities for use.)[/QUOTE] Yeah you can compile C in a C++ compiler, but if you're doing a kernel you can't use most of the C++ features AFAIK. Things like classes and even std::string require external stuff that a kernel can't do. Especially in the early parts of the bootup sequence.
I don't know why classes shouldn't work, but std::string is part of libstdc++, as such not usable unless you write one for your system. Same rules for libstdc though.
[QUOTE=PvtCupcakes;22874353]Things like classes and even std::string require external stuff that a kernel can't do. Especially in the early parts of the bootup sequence.[/QUOTE] What are you talking about? All you can't use is the C++ runtime, which includes exceptions, RTTI, and some other things. Classes are part of the language and will work without issue. The only issue you may encounter is with having to manually call global instance's constructors, and that's well documented. And of course you wouldn't be able to use std::string as is - first you'd have to write a library for your kernel that can allocate and deallocate memory. After that, you might be able to reuse a lot of parts of GCC's or MSVC's standard library, as long as you make sure they don't use exceptions (or if you implement exceptions). It's not any different for the C standard library so it doesn't matter. [editline]10:35AM[/editline] [QUOTE=Jawalt;22867762]C++ is not a superset of C. "99%" is hilarious, considering most C compilers won't even compile 99% of the C99 standard![/QUOTE] No where did I say C++ is a superset of C. And 99% is just about right - there are very few things in modern C that a modern C++ compiler cannot compile.
[QUOTE=nullsquared;22874706]The only issue you may encounter is with having to manually call global instance's constructors, and that's well documented.[/QUOTE] A well documented joke...
[QUOTE=blankthemuffin;22874895]A well documented joke...[/QUOTE] ?? No, it's because you don't have a C++ runtime on the kernel, and therefore there is no way for the globals to be initialized unless you specifically do so.
I understand that, but it's another of the 'features' of C++ that especially don't play nice with kernel development. Undefined execution order before the so called entry point? Awesome. Once you cut out all these things that you mention, it kinda makes me wonder why you even bother writing your kernel in C++ anyway.
Sorry, you need to Log In to post a reply to this thread.