Jump to content

Not a bad start on C from Lou and Padre, even though they totally screwed up explaining the condi...


G+_Lee Crocker
 Share

Recommended Posts

Not a bad start on C from Lou and Padre, even though they totally screwed up explaining the conditional expression. I'm sure they realized that minutes after posting the episode. :-)

 

To start with C, as they said, you'll need a compiler, and some associated tools like "make". If you're on a Mac, you have no choices, because, well, because it's Apple, and Apple doesn't give users choices. So go download Xcode, which they'll tell you is free, but they'll require all your personal information and charge you real money if you actually want to use it for anything.

 

Since the Linux kernel itself and many development tools are built with GCC, that's the simplest and usually the best choice there. In fact, Linux wouldn't exist without GCC and many other Gnu tools, so as much as I might disagree with Stallman on other issues, he's totally right that "Gnu/Linux" is just giving credit where it's due. On some distros you might have to install a package: for example on Ubuntu the package is called "build-essential". There is also Clang that Lou mentioned and other compilers available. There are also many IDEs available, like Eclipse, CodeBlocks, and Anjuta. Git may be in a separate package as well.

 

GCC is a good choice for Windows as well. Visual Studio Express does not compile the C language. It compiles C++, C#, and a small subset of C from two decades ago, but nothing like the actual living useful C language. I have been told that the for-pay VS does, but I am unable to confirm that claim.

 

There are two ways to get GCC on Windows: Cygwin that Lou mentioned, and MingW/MSYS. I'm going to recommend the latter. Gygwin is a whole OS layer on top of Windows, and programs it creates drag the whole system along with it. You get some powerful Unix/Linux features with that, but it's cumbersome. MingW uses standard Windows libraries, and can even make libraries linkable into other Windows programs made with VS and such (for example, my card game simulation library http://lcrocker.github.io/onejoker/ is built with MingW and will link with other Windows code). It's more Windows-like, so Windows users should be more comfortable with it. Old Linux hands forced to use Windows for some reason might prefer Cygwin. You should also install Git, which comes with its own shell for Windows.

 

SublimeText that Lou used is great, and available for all platforms, but is not free. I'm a Vim guy. On Windows, I use that or Notepad++.

http://lcrocker.github.io/onejoker

Link to comment
Share on other sites

Great Lee! I can confirm it does in-fact compile C: https://msdn.microsoft.com/en-us/library/bb384838.aspx

 

This version supports partial C99 and C11: http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx

 

However, if you want more support for ISO C99 or C11 libraries you will need to use Visual Studio 2015: http://blogs.msdn.com/b/vcblog/archive/2014/11/17/c-11-14-17-features-in-vs-2015-preview.aspx 

VS 2015 incorporates the C99 Standard Library by reference, 2015 Preview fully supports the C99 Standard Library (with the only omissions being tgmath.h, which requires C compiler magic and is not relevant to C++ which has overloading, and CX_LIMITED_RANGE/FP_CONTRACT which also require compiler support).

Link to comment
Share on other sites

Thanks for the research, Lou, but I've read all those pages and I'm not convinced--they sound like more Microsoft empty promises. They talk about the C99 library, but not the language. Even the 2015 preview is wishy-washy about things like variadic macros. I'd be surprised if it compiled my little cardlib,, much less something like the Linux kernel or Python.

Link to comment
Share on other sites

Apple command line developer tools is still an Apple product. It contains proprietary headers for OSX libraries, and requires an Apple ID to download. It is gcc-based, and is nice, but it's not free software by any stretch.

 

I realized recently that both Windows 10 and VS 2015 had downloadable previews (also requiring logins, etc.) I created a VirtualBox with them and my initial attempts with C code worked well. I'll try some more complex code when I get home tonight and let you know if in fact Microsoft makes a C compiler.

Link to comment
Share on other sites

I am aware that there are several good Java implementations for OSX that enable development of truly free software, and I'm glad to hear other languages as well. I'm just not sure about C. If I develop an app with the command line tools acquired from someone else, including a Cocoa GUI, are you telling me that I can sell that app anonymously without any contract or any other communication with Apple, and without fear that they will object?

Link to comment
Share on other sites

Ummm... Yes?

 

I have no idea where you get this idea. Every source forge project I've ever done was done on a Mac, using XCode or using command-line tools. (It would really be impressive for Apple to charge for XCode, seeing how it's a front end to GCC or Clang.) Two of these projects use Cocoa, one is a very old app for the Palm Pilot and one is Java based.

 

Yes, I did indeed join the ADC once, long ago. It was free, and I've never paid them a cent in the years since, nor have they ever demanded approval of my open source projects.

 

https://developer.apple.com/register/

 

If you're confused by the $99/year "Mac Developer Program" - that does certainly cost money. The $99 is to pay for tech support. 

 

Edit: I did have to update my agreement to their developer program a few years ago. This is the agreement: https://developer.apple.com/programs/terms/registered_apple_developer_20100301.pdf

 

I just skimmed through it. I don't see anything about ceding commercial rights to Apple.

Link to comment
Share on other sites

BTW - I just double checked Source Forge, since I've been too busy the past several years to do more FOSS stuff. A quick search shows that the Cocoa scene is still active, including projects like Stellarium, my favorite astronomy application.

 

Edit: BTW - were you aware that Clang was developed by Apple?

Link to comment
Share on other sites

Lee, I realize I come across as brusque sometimes. You do have a point about selling commercial apps in Apple's own App Store - I believe that if you want to do that you do have to join the "paid up" developer's program, and it is also true that if a user wants to install an application that doesn't come from the App Store they have to jump through some hoops and will see security warnings about the app not being signed.

 

Personally, my preferred dev environment is what I use in my day job: vim, gcc and make on a Linux machine.

Link to comment
Share on other sites

I'm glad to hear that "Apple" and "free software" can be uttered together without irony. I have some C libraries that work on Linux and Windows, and I'd be happy to make them work on OSX if I could figure out way to do that without dealing with Apple. Maybe I'll find a Mini on eBay or something, then get someone else to download the tools for me.

Link to comment
Share on other sites

 Share

×
×
  • Create New...