clifton_r@verifone.com (11/13/90)
The following contains the changes to my draft V7 C spec since its last posting, in the form of a GNU diff with context. I am posting only diffs to hold down the volume of the posting. I will mail the current spec to any individual requesting it. -- Clifton --------------------------- c u t -- h e r e ---->8------------------------ *** v7spec.o24 Thu Oct 25 14:36:12 1990 --- v7spec.n08 Thu Nov 08 17:03:06 1990 *************** *** 1,3 **** UNIX V7 C Language Specification ! Revision A.1. 24 October 1990 --- 1,3 ---- UNIX V7 C Language Specification ! Revision A.2. 08 November 1990 *************** *** 9,12 **** ! Tel: +1 808 623-2911 ! FAX: +1 808 623-3201 --- 9,12 ---- ! Tel: +1 808 623 2911 ! FAX: +1 808 623 3201 *************** *** 15,16 **** --- 15,21 ---- + Modification history: + Rev A.1. 90/10/24 - first stable version of document + Rev A.2. 90/11/08 - deleted refs to "signed", added info on diff's + between Ritchie V7 C compiler and later PCC-based compilers. + 0. INTRODUCTION *************** *** 52,55 **** ! To summarize the usual V7 C extensions, this implementation of the C ! language supports: o the "enum" declaration for enumerated types [3]; --- 57,60 ---- ! To summarize the usual V7 C extensions, this dialect of the C language ! supports: o the "enum" declaration for enumerated types [3]; *************** *** 60,68 **** o the "void" data type (but not the "void *" of ANSI C); ! o the "signed char" type; ! o the "unsigned char", "unsigned short", and "unsigned long" types; ! o and calling of function pointers without an explicit dereference. ! o conditional assignment of structures and unions via "a?b:c"; ! It also supports the following C features which are considered archaic ! or traditional, and are not supported in the most recent C compilers: o "Old-fashioned" initializers, such as "int i 3;"; --- 65,89 ---- o the "void" data type (but not the "void *" of ANSI C); ! o separate member name spaces for structure and union types; ! o the "unsigned char", "unsigned short", and "unsigned long" types. ! ! NOTE: The original Ritchie C compiler distributed with UNIX Version 7 ! supported only those features flagged with reference [3] above. It did ! not support the "void" data type, the additional "unsigned" types, or ! the separate name spaces for union/structure types. ! ! Steven Johnson's PCC was the first to implement these features, and the ! writers of most other V7 compilers followed his lead. A V7 C compiler which ! fails to support the "void" type, or the additional "unsigned" types, or ! which follows the Ritchie name-space rules for structure and union members, ! should preferably document the fact. ! ! Many V7 C compilers support the following additional extensions: ! o calling of function pointers without an explicit dereference; ! o conditional assignment of structures and unions via "a?b:c". ! ! These features should be specifically documented if supported. ! V7 C compilers also generally support the following C features which ! are considered archaic or traditional, and are not supported in the most ! recent C compilers: o "Old-fashioned" initializers, such as "int i 3;"; *************** *** 72,73 **** --- 93,95 ---- + 1. Introduction *************** *** 79,86 **** describe the functionality of, and the language implemented by the majority ! of C compilers released with UNIX Version 7. That is, it intends to ! describe the C dialect generally classed as "UNIX Version 7" C or V7 C. In ! some areas, a single behavior or feature set will be specified; in other ! areas, a range of behaviors will be described, any one of which may be ! considered acceptable or normal in a given implementation. 2. Lexical conventions --- 101,111 ---- describe the functionality of, and the language implemented by the majority ! of C compilers released with UNIX Version 7, and by a number of subsequent ! compilers modeled on the Bell Labs C Compilers. That is, it intends to ! describe the C dialect generally classed as "UNIX Version 7" C or V7 C. + In some areas, a single behavior or feature set will be specified; in + other areas, a range of behaviors will be described, any one of which may be + considered acceptable or normal in a given implementation. Some historical + background will be given where appropriate. + 2. Lexical conventions *************** *** 126,130 **** ! The words "signed", "void", "enum", and possibly "asm" are reserved as ! keywords. The words "entry" and "fortran" are not reserved. 2.4. Constants --- 151,160 ---- ! The words "void", "enum", and possibly "asm" are reserved as keywords. ! ! The words "entry" and "fortran" are not reserved. + NOTE: "void" was not implemented in the original Ritchie V7 C compiler. + A very few V7 compilers may therefore fail to support it, but those + compilers should preferably document that it is not supported. + 2.4. Constants *************** *** 154,155 **** --- 184,189 ---- + NOTE: "unsigned long" was not implemented in the original Ritchie V7 C + compiler. A very few V7 compilers may therefore fail to support it, but + those compilers should preferably document that it is not supported. + 2.4.2. Explicit long constants *************** *** 172,173 **** --- 206,211 ---- + NOTE: "unsigned long" was not implemented in the original Ritchie V7 C + compiler. A very few V7 compilers may therefore fail to support it, but + those compilers should preferably document that it is not supported. + 2.4.3 Character constants *************** *** 225,229 **** ! The "signed" attribute may be used to modify an integral type ! declaration. Since this is the default attribute for "int"s, "short"s, and ! "long"s, this is primarily useful for "char" declarations. --- 263,267 ---- ! NOTE: "void" was not implemented in the original Ritchie V7 C compiler. ! A very few V7 compilers may therefore fail to support it, but those ! compilers should preferably document that it is not supported. *************** *** 230,233 **** The "char" type may be either signed or unsigned by default. A "char" ! type declaration may be explicitly declared as either "signed" or ! "unsigned". --- 268,270 ---- The "char" type may be either signed or unsigned by default. A "char" ! type declaration may be explicitly declared as "unsigned". *************** *** 241,242 **** --- 278,284 ---- + NOTE: "unsigned char" and "unsigned long" were not implemented in the + original Ritchie V7 C compiler. A very few V7 compilers may therefore + fail to support them, but those compilers should preferably document + that they are not supported. + 5. Objects and lvalues *************** *** 254,257 **** The "char" type may be either signed or unsigned by default. A "char" ! type declaration may be explicitly declared as either "signed" or ! "unsigned". --- 296,298 ---- The "char" type may be either signed or unsigned by default. A "char" ! type declaration may be explicitly declared as "unsigned". *************** *** 281,282 **** --- 322,328 ---- + NOTE: "unsigned char" and "unsigned long" were not implemented in the + original Ritchie V7 C compiler. A very few V7 compilers may therefore + fail to support them, but those compilers should preferably document + that they are not supported. + 6.2 Float and double *************** *** 333,334 **** --- 379,384 ---- + NOTE: "void" was not implemented in the original Ritchie V7 C compiler. + A very few V7 compilers may therefore fail to support it, but those + compilers should preferably document that it is not supported. + Note that "++" and "--" are defined by this section to be unary *************** *** 384,389 **** ! The second and third expressions of the conditional may be structures ! or unions of the same type, in which case the type of the expression is the ! common structure or union type. Not all V7 C compilers accept conditional ! assignment of structures or unions. --- 434,445 ---- ! Some V7 C compilers accept conditional assignment of structures or ! unions. In this case, the second and third expressions of the conditional ! may be structures or unions of the same type, in which case the type of the ! expression is the common structure or union type. Not all V7 C compilers ! accept this construct. ! ! Compilers differ substantially as to the complexity of the expression ! which can appear as the second operand. Some will accept a completely ! general expression (including an assignment expression), while others are ! more restricted. *************** *** 432,437 **** NOTE: The syntax given specifically permits the declarator-list to be ! omitted. Therefore "int ;" is a perfectly valid declaration, which declares ! no variables. A compiler may issue a warning for a declaration of this ! form. 8.1. Storage class specifiers --- 488,498 ---- NOTE: The syntax given specifically permits the declarator-list to be ! omitted. Therefore "int ;" is a perfectly valid declaration, which ! declares no variables. A compiler may issue a warning for a ! declaration of this form. + NOTE: "unsigned char" and "unsigned long" were not implemented in the + original Ritchie V7 C compiler. A very few V7 compilers may therefore + fail to support them, but those compilers should preferably document + that they are not supported. + 8.1. Storage class specifiers *************** *** 444,447 **** ! "void" and "signed" must be added to the list of possible type- ! specifiers. --- 505,511 ---- ! "void" must be added to the list of possible type-specifiers. ! ! NOTE: "void" was not implemented in the original Ritchie V7 C compiler. ! A very few V7 compilers may therefore fail to support it, but those ! compilers should preferably document that it is not supported. *************** *** 450,455 **** ! The word "signed" may be thought of as an additional adjective which ! may be applied to an integral type specifier; moreover, "unsigned" may be ! used in combination with "char", "short", and "long". This means the ! following additional combinations are acceptable: --- 514,519 ---- ! The word "unsigned" may be thought of as an adjective which may be ! applied to an integral type specifier; it may be used in combination with ! "char", "short", and "long". This means the following additional ! combinations are acceptable: *************** *** 458,469 **** unsigned long (or) unsigned long int - signed char - signed short (or) signed short int - signed (or) signed int - signed long (or) signed long int ! The keywords "signed", "unsigned", and "short" may not be applied to ! "float" or "double." The type "long double" is not supported. ! A V7 C compiler should always support the "void" type and "enum" types. 8.3 Declarators --- 522,535 ---- unsigned long (or) unsigned long int ! The keywords "unsigned" and "short" may not be applied to "float" or ! "double." The type "long double" is not supported. ! NOTE: "unsigned char" and "unsigned long" were not implemented in the ! original Ritchie V7 C compiler. A very few V7 compilers may therefore ! fail to support them, but those compilers should preferably document ! that they are not supported. + A V7 C compiler must support the "enum" types, and should preferably + also support the "void" type. + 8.3 Declarators *************** *** 484,489 **** different components. In Ritchie, component names for all structures were ! drawn from a single name space, and components of different structures could ! have the same name only if they had the identical type and identical offset ! (relative position) within the structure. A V7 C compiler should not ! enforce this restriction. --- 550,560 ---- different components. In Ritchie, component names for all structures were ! drawn from a single name space, and components of different structure types ! could have the same name only if they had the identical type and identical ! offset (relative position) within the structure. A V7 C compiler should ! generally not enforce this restriction. ! ! NOTE: Separate name spaces for distinct structure and union types were ! not implemented in the original Ritchie V7 C compiler. A very few V7 ! compilers may therefore fail to support them, but those compilers ! should preferably document that they are not supported. *************** *** 698,700 **** that block. The compiler documentation should describe which scope rule is ! followed in this case. --- 769,771 ---- that block. The compiler documentation should describe which scope rule is ! followed for in this case. *************** *** 831,837 **** ! A function pointer followed by a parenthesized parameter list is ! interpreted as a dereference of the function pointer, followed by a call of ! the function; thus following the declaration "int (*funcp)();" the two ! statements "(*funcp)();" and "funcp();" are equivalent. 14.3 Conditional compilation --- 902,912 ---- ! Some V7 C compilers will automatically dereference a function pointer ! in the context of a function call. That is, the use of the pointer, ! followed by a parenthesized parameter list, is interpreted as a dereference ! of the function pointer, followed by a call of the function; thus following ! the declaration "int (*funcp)();" the two statements "(*funcp)();" and ! "funcp();" are equivalent. + Not all V7 C compilers accept this usage. + 14.3 Conditional compilation *************** *** 889,891 **** ! Add "signed" and "void" to the type-specifier list. --- 964,970 ---- ! Add "void" to the type-specifier list. ! ! NOTE: "void" was not implemented in the original Ritchie V7 C compiler. ! A very few V7 compilers may therefore fail to support it, but those ! compilers should preferably document that it is not supported. ------------------------------------------------------------------------------- clifton_r@zon.verifone.com