# HG changeset patch # User roug # Date 1038047951 0 # Node ID 497d17b4b264e5d05e5b6b6e7d9525e3cd76f225 # Parent b8ed2006640e1801fa11dfcb100e8c3baf733b53 Finished all the error messages in appendix A diff -r b8ed2006640e -r 497d17b4b264 docs/ccguide/chap4.chapter --- a/docs/ccguide/chap4.chapter Sat Nov 23 10:39:11 2002 +0000 +++ b/docs/ccguide/chap4.chapter Sat Nov 23 10:39:11 2002 +0000 @@ -11,6 +11,58 @@ buffering of I/O channels improves the speed of file access because fewer system calls are necessary. + +The high-level I/O functions should not be confused with the +low-level system calls with similar names. Nor shoul "file +pointers" be confused with "path numbers". The standard library +functions maintain a structure for each file open that holds status +information and a pointer into the files buffer, A user program +uses a pointer to this structure as the "identity" of the file +(which is provided by "fopen()"), and passes it to the various +I/O functions. The I/O functions will make the low-level system +calls when necessary. + + +Using a file pointer in a systen call, or a path number in a +Standard Library call, is a common mistake among beginners to C and, +if made, will be sure to crash your program. + + +The convenience functions include facilities for copying, +comparing, and concatening strings, converting numbers to strings, +and doing the extra work in accessing systen information such as the +time. + + +In the page which follow, the functions available are +described in terms of what they do and the parameters they expect. +The "USAGE" section shows the name of the function and the type +returned (if not int). The declaration of arguments are shown as +they would be written in the function definition to indicate the +types expected by the function. If it is necesary to include a +file before the function can be used, it is shown in the "USAGE" +section by "#include <filename>". + + +Most of the header files that are required to be included, must +reside in the "DEFS" directory on the default system drive. If the +file is included in the source program using angle bracket +delimiters instead of the usual double quotes, the compiler will +append this path name to the file name. For example, "#include <stdio.h>" +is equivalent to "#include </d0/defs/stdio.h>", if "/d0" is +the path name of the default system drive. + + +Please note that if the type of the valye returned by a +function is not INT, you should make a pre-declaration in your +program before calling it. For example, if you wish to use +"atof()", you should pre-declare by having "double atof();" +somewhere in your program before a call to it. Some functions +which have associated header files in the DEFS directory that +should be included, will be pre-declared for you in the header. An +example of this is "ftell()" which is pre-declared in "stdio.h". If +you are in any doubt, read the header file. + &atofref; &fcloseref; diff -r b8ed2006640e -r 497d17b4b264 docs/ccguide/errors.appendix --- a/docs/ccguide/errors.appendix Sat Nov 23 10:39:11 2002 +0000 +++ b/docs/ccguide/errors.appendix Sat Nov 23 10:39:11 2002 +0000 @@ -1,9 +1,9 @@ Compiler Generated Error Messages -The error codes are shown in both hexadecimal (first column) and -decimal (second column). Error codes other than those listed are -generated by programming languages or user programs. +Below is a list of the error messages that the C compiler generates, +and, if applicable, probable causes and K & R Appendix A section +number (in parenthesis) to see for more specific information. already a local variable @@ -36,6 +36,8 @@ argument storage +Function arguments may only be declared as storage class +register. (10.1) @@ -43,6 +45,8 @@ bad character +A character not in the C character set (probably a control +char) was encountered in the source file. (2) @@ -50,6 +54,7 @@ both must be integral +>> and << operands cannot be FLOAT or DOUBLE. (7.5) @@ -57,6 +62,8 @@ break error +The break statement is allowed only inside a while, do, for or +switch block. (9.8) @@ -64,6 +71,8 @@ can't take address +& operator not allowed in a register variable. Operand must +otherwise be an lvalue. (7.2) @@ -71,13 +80,16 @@ cannot cast +Type result of cast cannot be FUNCTION or ARRAY. (7.2, 8.7) -cannot evaluate data +cannot evaluate size +Could not determine size from declaration or initializer. +(8.6, 14.3) @@ -85,6 +97,8 @@ cannot initialize +Storage class or type does not allow variable to be +initialized. (8.6) @@ -92,6 +106,9 @@ compiler trouble +Compiler detedted something it couldn't handle. Try compiling +the program again. If this error still occurs, contact +Microware. @@ -99,6 +116,8 @@ condition needed +While, do, for, switch and if statements require a condition +expression. (9.3) @@ -106,6 +125,11 @@ constant expression required +Initializer expressions for statis or external variables cannot +reference variables. They may, however, refer to the address +of a previously declared variable. This installation allows no +initializer expressions unless all operands are of type INT or +CHAR (8.6) @@ -113,6 +137,8 @@ constant overflow +Input numeric constant was too large for the implied or +explicit type. (2.6, [PDP-11]) @@ -120,6 +146,8 @@ constant required +Variables are not allowed for array dimensions or cases. (8.3, +8.7, 9.7) @@ -127,6 +155,8 @@ continue error +The continue statement is allowed only inside a while, do, or +for block. (9.9) @@ -134,6 +164,12 @@ declaration mismatch +This declaration conflicts with a previous one. This is +typically caused by declaring a function to return a non-integer +type after a reference has been made to the function. +Depending on the line structure of the declaration block, this +error may be reported on the line following the erroneous +declaration. (11, 11.1, 11.2) @@ -141,6 +177,7 @@ divide by zero +Divide by zero occurred when evaluating a constant expression. @@ -148,6 +185,8 @@ ? expected +? is any character that was expected to appear here. Missing +semicolons or braces cause this error. @@ -155,6 +194,7 @@ expression missing +An expression is required here. @@ -162,6 +202,8 @@ function header missing +Statement or expression encountered outside a function. +Typically causes by mismatched braces. (10.1) @@ -169,6 +211,8 @@ function type error +A function cannot be declared as returning an array, function, +struct, or union. (8.4, 10.1) @@ -176,6 +220,8 @@ function unfinished +End-of-file encountered before the end of function definition. +(10.1) @@ -183,6 +229,7 @@ identifier missing +Identifier name required here but none was found. @@ -190,6 +237,8 @@ illegal declaration +Declarations are allowed only at the beginning of a block. +(9.2) @@ -197,6 +246,7 @@ label required +Label name required on goto statement. (9.11) @@ -204,6 +254,7 @@ label undefined +Goto to label not defined in the current function. (9.12) @@ -211,6 +262,8 @@ lvalue required +Left side of assigment must be able to be "stored into". +Array names, functions, structs, etc. are no lvalues. (7.1) @@ -218,6 +271,7 @@ multiple defaults +Only one default statement is allowed in a switch block. (9.7) @@ -225,6 +279,8 @@ multiple definition +Identifier name was declared more than once in the same block +level (9.2, 11.1) @@ -232,6 +288,7 @@ must be integral +Type of object required here must be type int, char or pointer. @@ -239,6 +296,7 @@ name clash +Struct-union member and tag names must be mutually distinct. (8.5) @@ -246,6 +304,7 @@ name in cast +Identifier name found in a cast. Only types are allowed. (7.2, 8.7) @@ -253,6 +312,7 @@ named twice +Names in a function parameter list may appear only once. (10.1) @@ -260,6 +320,8 @@ no 'if' for 'else' +Else statement found with no matching if. This is typically +caused by extra or missing braces and/or semicolons. (9.3) @@ -267,6 +329,7 @@ no switch statement +Case statements can only appear within a switch block. (9.7) @@ -274,6 +337,9 @@ not a function +Primary in expression is not type "function returning...". If +this is really a function call, the function name was declared +differently elsewhere. (7.1) @@ -281,6 +347,7 @@ not an argument +Name does not appear in the function parameter list. (10.1) @@ -288,6 +355,9 @@ operand expected +Unary operators require one operand, binary operators two. +This is typically caused by misplaced parenthesis, casts or +operators. (7.1) @@ -317,6 +387,7 @@ pointer mismatch +Pointers refer to different types. Use a case if required. (7.1) @@ -324,6 +395,8 @@ pointer or integer required +A pointer (of any type) or integer is required to the left of +the '->' operator. (7.1) @@ -331,6 +404,7 @@ pointer required +Pointer operand required with unary * operator. (7.1) @@ -338,6 +412,7 @@ primary expected +Primary expression required here. (7.1) @@ -345,6 +420,9 @@ should be NULL +Second and third expression of ?: conditional operator cannot +be pointers to different types. If both are pointers, they +must be of the same type or one of the two must be null. (7.13) @@ -352,6 +430,8 @@ **** STACK OVERFLOW **** +Compiler stack has overflowed. Most likely cause is very deep +lock-level nesting or hundreds of switch cases. @@ -359,6 +439,8 @@ storage error +Reg and auto storage classes mey only be used within functions. +(8.1) @@ -366,6 +448,8 @@ struct member mismatch +Identical member names in two different structures must have +the same type and offset in both. (8.5) @@ -373,6 +457,8 @@ struct member required +Identifier used with . and -> operators must be a structure +member name. (7.1) @@ -380,6 +466,7 @@ struct syntax +Brace, comma, etc. is missing in a struct declaration. (8.5) @@ -387,6 +474,7 @@ struct or union inappropiate +Struct or union cannot be used in the context. @@ -394,6 +482,7 @@ syntax error +Expression, declaration or statement is incorrectly formed. @@ -401,6 +490,9 @@ third expression missing +? must be followed by a : with expression. This error may be +causes by unmatched parenthesis or other errors in the +expression. (7.13) @@ -408,6 +500,8 @@ too long +Too many characters provided in a string initializing a +character array. (8.6) @@ -415,6 +509,8 @@ too many brackets +Unmatched or unexpected brackets encountered processiong an +initializer. (8.6) @@ -422,6 +518,8 @@ too many elements +More data items supplied for aggregate level in initializer +than members of the aggregate. (8.6) @@ -429,6 +527,7 @@ type error +Compiler type matching error. Should never happen. @@ -436,6 +535,7 @@ type mismatch +Types and/or operators in expression do not correspond. (6) @@ -443,6 +543,7 @@ typedef - not a variable +Typedef type name cannot be used in this manner. (8.8) @@ -450,6 +551,7 @@ undeclared variable +no declaration exists at any block level for this identifier. @@ -457,6 +559,8 @@ undefined structure +Union or struct declaration refers to an undefined structure +name. (8.5) @@ -464,6 +568,7 @@ unions not allowed +Cannot initialize union members. (8.6)