Compiling ANSI C code with MPW

Discussion in 'Mac Programming' started by avw, May 28, 2009.

  1. avw macrumors newbie

    May 28, 2009
    I need to compile an absolute plattform independent sourcecode which is written in ANSI C, via MPW for MacOS 9. As I´m absolutely new to programming at all, I´d search for someone who will lend me a hand and go through the questions depending the errors while compiling. Would be an easy thing for programmers like you, but not possible for me, without knowledge of C. As I don´t want to disturb you here with silly questions, please contact me private.

    I already set up the latest MPW GM with all the updates to 3.6b2 and compiled "silly balls" successfully ;)
  2. larkost macrumors 6502a

    Oct 13, 2007
    I think you are going to run into a problem with "absolute plattform independent sourcecode". I don't believe that there is such a thing. MacOS 9 is going to pose a problem here because it does not have the idea of stdin/stdout/stderr (at least that is my memory). It was really a different programming environment than POSIX (which is what C sort-of assumes).
  3. gnasher729 macrumors P6


    Nov 25, 2005
    When you are using MPW and writing command line tools, stdin/stdout/stderr work just fine. C doesn't assume Posix, C assumes a working C Standard Library, which MPW has. Of course if the code itself assumes Posix, there is some support for it, but I don't think it is fully supported. For example, Posix threads would be a problem. On the other hand, that kind of code wouldn't run on a Windows system either.

    The real problem is finding anyone who would be able to help him. I haven't created any new MPW projects in many years; I still have a Mac running MacOS 9 and MPW and pray once a month that I don't need to turn it on :rolleyes:
  4. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    ANSI C is ANSI C no matter the platform. As long as the compiler supports C 89 then the code will work fine assuming you haven't brought in any non-standard code.

    MPW is ANSI C compatible so you should have absolutely no problems. The only issues you might have are to do with the standard implementation specific areas of the C standard although you would face that on any system and is nothing specific to MPW or Mac OS 9.
  5. avw thread starter macrumors newbie

    May 28, 2009
    Yes, because nobody contacted me till now. I really think it´s not a big problem for you. For example MrC reports:

    It´s possible to easily delete this variable t2 at the start of the funktion, and the warning will not appear again. But I do not understand if it´s ok. to do this, ... ;)
    I expect this questions for the most of you beeing absolute uninterresting newbie-issues, and would really preferre if someone would clear such questions in private communication with me.
  6. gnasher729 macrumors P6


    Nov 25, 2005
    Something like that is a generic C question, and anybody with knowledge of C can help you, including many here, so you are likely to get an answer. What would be hard is finding help for MPW specific question, because nobody knows the answer anymore.

    To your question: The compiler thinks that the variable isn't used in that function. Sometimes a variable is only used in a variant of the code; there might be a bit like

    #ifdef DEBUG
        t2 = x + y;
        printf ("x + y = %d\n", t2);
    and if you remove t2, that part wouldn't compile anymore if DEBUG is defined. So you look for t2; if it isn't used like that then you can delete it.

Share This Page