home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / duucp-1.17 / AU-117b4-src.lha / src / porting.doc next >
Encoding:
Text File  |  1993-06-09  |  2.0 KB  |  56 lines

  1.  
  2. The following are things to keep in mind when writing new code so that
  3. it compiles cleanly under registered DICE, unregistered DICE and SASC.
  4.  
  5. 1) Make sure every function has an ANSI style declaration to prevent
  6.    SASC warnings.
  7.  
  8. 2) DICE and SASC sometimes disagree about which function arguments
  9.    are declared const.  For example:
  10.  
  11.     extern int stricmp(char *, char *);                 //SASC
  12.     extern int stricmp(const char *, const char *);     //DICE
  13.  
  14.    If you pass a const pointer to stricmp(), cast away the constness
  15.    to suppress an SASC compiler warning.
  16.  
  17.    For example:
  18.  
  19.        const char *p = "abc";
  20.        const char *q = "def";
  21.  
  22.        stricmp((char *)p, (char *)q);
  23.  
  24. 3) The SASC compiler option ObjectName is used to specify where the
  25.    resulting object code should be placed. The sc command  has a bug which
  26.    prevents ObjectName= from being used when compiling an assembly file.
  27.    This required assembly files to be handled seperatly from c files in
  28.    the lib dmakefile.  Assembly objects are compiled into the current
  29.    directory and then copied to their final destination.
  30.  
  31. 4) The preprocessor symbol indicating that code is being compiled for
  32.    an amiga differs between DICE and SASC.
  33.  
  34.    DICE   uses   AMIGA
  35.    SASC   uses  _AMIGA
  36.  
  37.    If you have AMIGA dependant code, the following at the start of your
  38.    c file will ensure it works under SASC too.
  39.  
  40.        #if defined (_AMIGA) && !defined (AMIGA)
  41.        #define AMIGA
  42.        #endif
  43.  
  44. 5) The registered version of DICE provides the __autoinit and __autoexit
  45.    features, but the unregistered version does not.  These features are
  46.    much like the _STI and _STD features of SASC.  They are great for
  47.    writing startup code that will automatically open a referenced
  48.    library.
  49.  
  50. 6) To convert a dmakefile which invokes DICE to a dmakefile which
  51.    invokes SASC, or vica versa, you can use the adj utility.  Adj
  52.    will scan the file looking for compiler options and convert
  53.    them.  Adj also provides conditionals.
  54.  
  55. Good luck, Chris Genly, 6/9/93
  56.