4

In case I'm writing a program (of any kind) in C, that is meant to be run on Linux environment, can I write it under OS X? (concurrency wise for example)

I'm asking this because I like programming in Xcode.

  • 2
    You can use any OS to write a program in any language for any OS. The only reason you inherently need something running the target OS is to test the program, and if your compiler of choice only runs on the target OS; all you need to write the program is a text editor. – cpast Apr 25 '15 at 23:09
  • I used to like IDEs, but once I got used to it, I learned to like the command line + a good editor (Gedit/Kate/Notepad++/Sublime/...) just as much. There's something nice about having the same interface/setup for everything I do. If you haven't, try it for a few months and see if you can learn to like it too. Just remember to use command history. And [build command] && ./executable is super useful. – Tyler Apr 26 '15 at 0:44
  • Well to tell you the truth, the reason I like xcode is because it has a nice auto complete and a good debugger. I'm kind of a beginner in C so it helps me very much. – johni Apr 26 '15 at 8:36
7

Sure, of course, since you can develop portable software that runs on both MacOS and Linux. Be sure to test it on Linux at regular intervals to make sure you haven't unintentionally added something unportable.

If you want to use Linux-specific features then you will have more of a hard time. Depending on what it is you do, the program may compile on MacOS but fail to work, or it may not compile at all. In that case, you can still "write" it on MacOS, but at that point you're just using MacOS as a text editor.

  • I see. Well for now I know that I'm going to use semaphores and fork(). What do you think now? – johni Apr 25 '15 at 18:40
  • 4
    Which kind of semaphore?. Googling around, I see that MacOS apparently does not support unnamed semaphores but supports named ones. The best way to find out whether what you're doing will work is to try it! Beyond that, it becomes a programming question, on topic for stackoverflow.com – Celada Apr 25 '15 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.