Re: (part 7) Han from China answers your C questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nick Keighley

    Re: (part 7) Han from China answers your C questions

    this poster tends to post with low information content
    but high abuse content.


    On Nov 2, 6:30 am, Nomen Nescio <nob...@dizum.c omwrote:
    lancer6...@yaho o.com said:
    <snip>
    [I] saw a function header defined as:
    >
    int Function(int value1, int value2, (int *A)(void *A1, int *A2, void
    *A3), void *A3)
    This specifies that parameter A is a pointer to a function
    and the function is called by
    >
    Function(value1 , value2, A, A3);
    'A' would be the name of a function. C automatically converts the name
    into
    a pointer to a function. The term used in the standard is "decays to
    a
    function pointer"
    Is the "(int *A)(void *A1, int *A2, void *A3)" in the function header
    equivalent to passing a function (A) to another function (Function)?
    it specifies that the parameter is a function pointer
    Practically speaking, yes. In CLC-talk, no. Numerous semanticists,
    postmodernists,
    <snip>

    your word salad seems more PoM than anything else I've
    seen recently on clc.

    Something to think about: If "(int *A)(void *A1, int *A2, void *A3)"
    were replaced by "int A[]", would an entire array be passed to
    Function() or something else?
    >
    If so, how are the arguments to A passed into Function when Function
    is called?
    >
    They're not, at least not in the sense you probably think.
    ok. It is specified that the parameter is a pointer to a function.
    The parameters aren't passed here. You needd to look at the call
    to A that, presumably, appears in Function().

    <snip nonsense>


    --
    Nick Keighley
  • Barry Schwarz

    #2
    Re: (part 7) Han from China answers your C questions

    On Sun, 2 Nov 2008 06:15:20 -0800 (PST), Nick Keighley
    <nick_keighley_ nospam@hotmail. comwrote:
    >this poster tends to post with low information content
    >but high abuse content.
    >
    >
    >On Nov 2, 6:30 am, Nomen Nescio <nob...@dizum.c omwrote:
    >lancer6...@yah oo.com said:
    >
    ><snip>
    >
    [I] saw a function header defined as:
    >>
    int Function(int value1, int value2, (int *A)(void *A1, int *A2, void
    *A3), void *A3)
    >
    >This specifies that parameter A is a pointer to a function
    >
    and the function is called by
    >>
    Function(value1 , value2, A, A3);
    >
    >'A' would be the name of a function. C automatically converts the name
    >into
    >a pointer to a function. The term used in the standard is "decays to
    >a
    >function pointer"
    Actually the word decay does not appear in the standard at all.
    6.3.2.1-4 says "A function designator is an expression that has
    function type. Except when it is the operand of the sizeof operator or
    the unary & operator, a function designator with type ‘‘function
    returning type’’ is converted to an expression that has type ‘‘pointer
    to function returning type’’.


    --
    Remove del for email

    Comment

    Working...