⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 implement-c.texi

📁 理解和实践操作系统的一本好书
💻 TEXI
📖 第 1 页 / 共 2 页
字号:
exception can be raised when a result is tiny but not inexact in anIEC 60559 conformant implementation (C99 F.9).}This is dependent on the implementation of the C library, and is notdefined by GCC itself.@end itemize@node Arrays and pointers implementation@section Arrays and pointers@itemize @bullet@item@cite{The result of converting a pointer to an integer orvice versa (C90 6.3.4, C99 6.3.2.3).}A cast from pointer to integer discards most-significant bits if thepointer representation is larger than the integer type,sign-extends@footnote{Future versions of GCC may zero-extend, or usea target-defined @code{ptr_extend} pattern.  Do not rely on sign extension.}if the pointer representation is smaller than the integer type, otherwisethe bits are unchanged.@c ??? We've always claimed that pointers were unsigned entities.@c Shouldn't we therefore be doing zero-extension?  If so, the bug@c is in convert_to_integer, where we call type_for_size and request@c a signed integral type.  On the other hand, it might be most useful@c for the target if we extend according to POINTERS_EXTEND_UNSIGNED.A cast from integer to pointer discards most-significant bits if thepointer representation is smaller than the integer type, extends accordingto the signedness of the integer type if the pointer representationis larger than the integer type, otherwise the bits are unchanged.When casting from pointer to integer and back again, the resultingpointer must reference the same object as the original pointer, otherwisethe behavior is undefined.  That is, one may not use integer arithmetic toavoid the undefined behavior of pointer arithmetic as proscribed inC99 6.5.6/8.@item@cite{The size of the result of subtracting two pointers to elementsof the same array (C90 6.3.6, C99 6.5.6).}The value is as specified in the standard and the type is determinedby the ABI@.@end itemize@node Hints implementation@section Hints@itemize @bullet@item@cite{The extent to which suggestions made by using the @code{register}storage-class specifier are effective (C90 6.5.1, C99 6.7.1).}The @code{register} specifier affects code generation only in these ways:@itemize @bullet@itemWhen used as part of the register variable extension, see@ref{Explicit Reg Vars}.@itemWhen @option{-O0} is in use, the compiler allocates distinct stackmemory for all variables that do not have the @code{register}storage-class specifier; if @code{register} is specified, the variablemay have a shorter lifespan than the code would indicate and may neverbe placed in memory.@itemOn some rare x86 targets, @code{setjmp} doesn't save the registers inall circumstances.  In those cases, GCC doesn't allocate any variablesin registers unless they are marked @code{register}.@end itemize@item@cite{The extent to which suggestions made by using the inline functionspecifier are effective (C99 6.7.4).}GCC will not inline any functions if the @option{-fno-inline} option isused or if @option{-O0} is used.  Otherwise, GCC may still be unable toinline a function for many reasons; the @option{-Winline} option may beused to determine if a function has not been inlined and why not.@end itemize@node Structures unions enumerations and bit-fields implementation@section Structures, unions, enumerations, and bit-fields@itemize @bullet@item@cite{A member of a union object is accessed using a member of adifferent type (C90 6.3.2.3).}The relevant bytes of the representation of the object are treated asan object of the type used for the access.  @xref{Type-punning}.  Thismay be a trap representation.@item@cite{Whether a ``plain'' @code{int} bit-field is treated as a@code{signed int} bit-field or as an @code{unsigned int} bit-field(C90 6.5.2, C90 6.5.2.1, C99 6.7.2, C99 6.7.2.1).}@opindex funsigned-bitfieldsBy default it is treated as @code{signed int} but this may be changedby the @option{-funsigned-bitfields} option.@item@cite{Allowable bit-field types other than @code{_Bool}, @code{signed int},and @code{unsigned int} (C99 6.7.2.1).}No other types are permitted in strictly conforming mode.@c Would it be better to restrict the pedwarn for other types to C90@c mode and document the other types for C99 mode?@item@cite{Whether a bit-field can straddle a storage-unit boundary (C906.5.2.1, C99 6.7.2.1).}Determined by ABI@.@item@cite{The order of allocation of bit-fields within a unit (C906.5.2.1, C99 6.7.2.1).}Determined by ABI@.@item@cite{The alignment of non-bit-field members of structures (C906.5.2.1, C99 6.7.2.1).}Determined by ABI@.@item@cite{The integer type compatible with each enumerated type (C906.5.2.2, C99 6.7.2.2).}@opindex fshort-enumsNormally, the type is @code{unsigned int} if there are no negativevalues in the enumeration, otherwise @code{int}.  If@option{-fshort-enums} is specified, then if there are negative valuesit is the first of @code{signed char}, @code{short} and @code{int}that can represent all the values, otherwise it is the first of@code{unsigned char}, @code{unsigned short} and @code{unsigned int}that can represent all the values.@c On a few unusual targets with 64-bit int, this doesn't agree with@c the code and one of the types accessed via mode attributes (which@c are not currently considered extended integer types) may be used.@c If these types are made extended integer types, it would still be@c the case that -fshort-enums stops the implementation from@c conforming to C90 on those targets.On some targets, @option{-fshort-enums} is the default; this isdetermined by the ABI@.@end itemize@node Qualifiers implementation@section Qualifiers@itemize @bullet@item@cite{What constitutes an access to an object that has volatile-qualifiedtype (C90 6.5.3, C99 6.7.3).}Such an object is normally accessed by pointers and used for accessinghardware.  In most expressions, it is intuitively obvious what is a readand what is a write.  For example@smallexamplevolatile int *dst = @var{somevalue};volatile int *src = @var{someothervalue};*dst = *src;@end smallexample@noindentwill cause a read of the volatile object pointed to by @var{src} and store thevalue into the volatile object pointed to by @var{dst}.  There is noguarantee that these reads and writes are atomic, especially for objectslarger than @code{int}.However, if the volatile storage is not being modified, and the value ofthe volatile storage is not used, then the situation is less obvious.For example@smallexamplevolatile int *src = @var{somevalue};*src;@end smallexampleAccording to the C standard, such an expression is an rvalue whose typeis the unqualified version of its original type, i.e. @code{int}.  WhetherGCC interprets this as a read of the volatile object being pointed to oronly as a request to evaluate the expression for its side-effects dependson this type.If it is a scalar type, or on most targets an aggregate type whose onlymember object is of a scalar type, or a union type whose member objectsare of scalar types, the expression is interpreted by GCC as a read ofthe volatile object; in the other cases, the expression is only evaluatedfor its side-effects.@end itemize@node Declarators implementation@section Declarators@itemize @bullet@item@cite{The maximum number of declarators that may modify an arithmetic,structure or union type (C90 6.5.4).}GCC is only limited by available memory.@end itemize@node Statements implementation@section Statements@itemize @bullet@item@cite{The maximum number of @code{case} values in a @code{switch}statement (C90 6.6.4.2).}GCC is only limited by available memory.@end itemize@node Preprocessing directives implementation@section Preprocessing directives@xref{Implementation-defined behavior, , Implementation-definedbehavior, cpp, The C Preprocessor}, for details of these aspects ofimplementation-defined behavior.@itemize @bullet@item@cite{How sequences in both forms of header names are mapped to headersor external source file names (C90 6.1.7, C99 6.4.7).}@item@cite{Whether the value of a character constant in a constant expressionthat controls conditional inclusion matches the value of the same characterconstant in the execution character set (C90 6.8.1, C99 6.10.1).}@item@cite{Whether the value of a single-character character constant in aconstant expression that controls conditional inclusion may have anegative value (C90 6.8.1, C99 6.10.1).}@item@cite{The places that are searched for an included @samp{<>} delimitedheader, and how the places are specified or the header isidentified (C90 6.8.2, C99 6.10.2).}@item@cite{How the named source file is searched for in an included @samp{""}delimited header (C90 6.8.2, C99 6.10.2).}@item@cite{The method by which preprocessing tokens (possibly resulting frommacro expansion) in a @code{#include} directive are combined into a headername (C90 6.8.2, C99 6.10.2).}@item@cite{The nesting limit for @code{#include} processing (C90 6.8.2, C996.10.2).}@item@cite{Whether the @samp{#} operator inserts a @samp{\} character beforethe @samp{\} character that begins a universal character name in acharacter constant or string literal (C99 6.10.3.2).}@item@cite{The behavior on each recognized non-@code{STDC #pragma}directive (C90 6.8.6, C99 6.10.6).}@xref{Pragmas, , Pragmas, cpp, The C Preprocessor}, for details ofpragmas accepted by GCC on all targets.  @xref{Pragmas, , PragmasAccepted by GCC}, for details of target-specific pragmas.@item@cite{The definitions for @code{__DATE__} and @code{__TIME__} whenrespectively, the date and time of translation are not available (C906.8.8, C99 6.10.8).}@end itemize@node Library functions implementation@section Library functionsThe behavior of most of these points are dependent on the implementationof the C library, and are not defined by GCC itself.@itemize @bullet@item@cite{The null pointer constant to which the macro @code{NULL} expands(C90 7.1.6, C99 7.17).}In @code{<stddef.h>}, @code{NULL} expands to @code{((void *)0)}.  GCCdoes not provide the other headers which define @code{NULL} and somelibrary implementations may use other definitions in those headers.@end itemize@node Architecture implementation@section Architecture@itemize @bullet@item@cite{The values or expressions assigned to the macros specified in theheaders @code{<float.h>}, @code{<limits.h>}, and @code{<stdint.h>}(C90 and C99 5.2.4.2, C99 7.18.2, C99 7.18.3).}Determined by ABI@.@item@cite{The number, order, and encoding of bytes in any object(when not explicitly specified in this International Standard) (C99 6.2.6.1).}Determined by ABI@.@item@cite{The value of the result of the @code{sizeof} operator (C906.3.3.4, C99 6.5.3.4).}Determined by ABI@.@end itemize@node Locale-specific behavior implementation@section Locale-specific behaviorThe behavior of these points are dependent on the implementationof the C library, and are not defined by GCC itself.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -