delphi-c

result of test 1:

1. Comment removal and file inclusion are important preprocessor tasks but type checking is a compiler task, not a C preprocessor task.

2. The #if is followed by:
    A constant expression that can involve constants, the defined operator and macro names.
3. Question: The identifier '4th_Loop' would be valid if:
--Wrong--

  • The first character was not a digit.
    Correct Answer(s):
  • None of the above.

    The answer is D. Reference 'Identifiers'. Slide 23.

    4. Question: In the following declaration what is x? int (* x())[10]
    --Correct--
    Correct Answer(s):

  • A function that returns a pointer to an array of ten integers.

    The answer is A. Reference 'Function and Function Pointer Declarations'. Slide 40.

    5. Question: What is true about declarations?
    --Correct--
    Correct Answer(s):

  • They have two parts, the declaration specifier and the declarator list.

    The answer is C. Reference 'Declarations'. Slide 28.

     

    6. Question: What is true about floating constants?
    --Correct--
    Correct Answer(s):

  • They can contain an integer part, a fraction part, an optionally signed exponent part and an optional type suffix.

     

     


     

     

     

    questions:

    1. Nevertheless the #undef directive shall not be used according to the C Coding Standards[C224]

     

    1.comments

    1.1 no nest

    1.2 in string constant, no comment 

    1.3 in charactoer literal, no comment

     

    2. macros

    2.1 macros already defined in C:

    _LINE_, _FILE_, _DATE_, _TIME_, _STDC_

     

    2.2 A macro with arguments is defiend as:

    #define name(arglist) replacement_text

    1. No space can be inserted between name and the first parenthesis

    2. apply to macro argument names in replacement text:

     

    3. #

    # stringigy operator

    ## concatenation operator

    3.1 #if is a compilation directive that is followed by a constant expression.

    the constant expression can involve only constants, macros or the defined operator.

    3.2 #elif follow the same rule as #if.

    3.3 #ifdef and #ifndef directives are followed by a macro name and test if it has been defined previously or not respectively

    3.4 all conditional compilation segments shall be terminated by an #endif directive.

     

    The line directive controls error reporting by specifying logical source file name and line numbers

    #line number "filename"

    or

    #line number

     

    The #error directive forces the compiler to generate an error message

    The #warning directive IS NOT standard but common. It works as the #error directive but generates a warning instead of an error message

    The #pragma directive provides options to the compiler and is  implementation defined.

     

    C LANGUAGE

    1. volatile:

    memory-mapped I/O,

    a pointer to a device register-- prevent the compiler from removing apparently redundant

    references through the pointer.

     

    2. int(*comp)(int e1, int e2);

    comp to be a pointer to a function that return int and take two ints as arguments.

     

    3. escape sequences

     

    4. enum

    names in different enums within the same compilation unit must be distinct but values do not

    need to be the same even in the same enum.

     

    Identifiers and keywords

    identifiers shall not rely on the significance of more than 31 characters

     

    Types and declarations

    Objects declared register have automatic storage and (if possible) stored in fast registers of the machine

    The auto and register specifiers can be used only within functions or in function prototypes.

    Const objects can be initialized but not modified afterwards

     

    The purpose of volatile is to force a compiler implementation to suppress optimizations that could otherwise occur.

    For example, for a machine with memory-mapped I/O, a pointer to a device register may be declared as a pointer to volatile in order to prevent the compiler from removing apparently redundant references through the pointer.

    int *a;

    ‘a’ is a direct-declarator, ‘*a’ is a declarator that indicates that ‘a’ is a  pointer type.

    int (*comp)(int e1, int e2);

    comp is a direct-declarator

    (*comp)is a direct-declarator

     

     

    Float* fet_level( char (*f)(int a))

    (Int (*f)(void)) Get_fet_handler(void)

     

    A big integer constant is taken as long if it does not fit in an integer one

    Also according to Delphi Standards [C68] all integer and floating constants shall be cast to the appropriate type. 

     

    A character constant is a character between single quotes as ‘B’.

    an arbitrary byte-sized bit pattern can be specified by '\ooo

     

     

     

     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值