Newsgroups: comp.sys.apple2.programmer Path: news.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!xlink.net!math.fu-berlin.de!informatik.tu-muenchen.de!hphalle4!behrenss From: behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens) Subject: ORCA/C 2.0.1 bug list Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem) Organization: Technische Universitaet Muenchen, Germany Date: Tue, 9 Nov 1993 12:41:04 GMT Message-ID: Lines: 101 ================== Bugs in ORCA/C 2.0.1, v.1.0 ======================= Preface ------- These are bugs found in ORCA/C 2.0.1 by various users. All of these have already been reported to The Byteworks. The purpose of this document is to help you when programming the GS, so that by knowing about problems in your tools, you can work around them. It is NOT intended to help you bashing ORCA/C because it has bugs. Every product has bugs, and a C compiler is no exception. Note that only a few of the bugs listed here could be entitled "hardcore", the rest ranges from "annoying" to "mildly amusing". Support those that support you!! The List -------- - If you declare a function as 'void foo(unsigned);' and define it as 'void foo(unsigned int bar)', you get a 'type conflict' error message. - Do NOT mix old-style function definitions with prototyped declarations. Passed parameters will be garbled if you attempt that. (I.e. don't do 'void foo (int *);', 'void foo (bar) int *bar;' - 'sscanf("foo","%d",&bar);' returns 1 as if it had correctly converted an integer. - 'sscanf("R A 3 0 4","%*[^PR]%c %c %d %d %d",&l,&q,&k,&m,&n),' returns 5. It should return 0, as '%*[^PR]' was not satisfied. - Defining a variable 'unsigned bar', assigning a value > INT_MAX to it, and casting that to (unsigned long) gives incorrect results. To work around this, define the variable as 'unsigned int bar' instead. - ORCA/C does not support tentative definitions. - 'printf("%d != %d\n",0x8000U << 1, 1U << 16);' should print '0 != 0', it does print '0 != 1'. Bit-shifts are obviously sometimes handled incorrectly. - ORCA/C requires that functions with variable arguments process all arguments they got before exiting. It also requires that printf() and scanf() process all arguments they get. ISO/C does not have these requirements. - For the last bug, I guess I'll have to display some code: /* * this code shows two problems. The first while() loop acts more as * if its body were 'nedges[*(++sp)]++', not 'nedges[*sp++]++'. * The second while() loop produces an int math error. */ #include #include #pragma debug 25 int main (int argc, char *argv[]) { short *sp; short R_arg[6] = { 0, 1, 2, 3, 4, -1 }; static short S_arg[6] = { 0, 1, 2, 3, 4, -1 }; short nedges[5] = {0,0,0,0,0}; sp = S_arg; while (*sp >= 0) { printf ("sp: %p *sp: %d nedges[*sp]: %d\n",sp,*sp,nedges[*sp]); nedges[*sp++]++; } sp = R_arg; while (*sp >= 0) { printf ("sp: %p *sp: %d nedges[*sp]: %d\n",sp,*sp,nedges[*sp]); nedges[*sp++]++; } return (EXIT_SUCCESS); } Conclusio --------- If you have discovered a bug in ORCA/C and you would like it included in this list, drop me e-mail at behrenss@informatik.tu-muenchen.de. November 1993, Soenke Behrens -- =========================================================================== More than silver, more than gold, I need ! behrenss@informatik. electricity. I need it for my dreams. ! tu-muenchen.de (RACTER) ! FIDO: 2:246/13 Soenke Behrens