Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #163267

Re: on confusing procedure names with the address of procedures

From Bart <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: on confusing procedure names with the address of procedures
Date 2021-10-30 11:36 +0100
Organization A noiseless patient Spider
Message-ID <slj77j$ufg$1@dont-email.me> (permalink)
References <86bl37e49v.fsf@levado.to>

Show all headers | View raw


On 30/10/2021 01:37, Meredith Montgomery wrote:

>     12 |   printf("c1 is at %p\n", &&c1);


&& is used for label address with some C implementations. Label c1 
doesn't exist. (Variable c1 does, but in C, variables and labels live in 
different namespaces; the same names can coexist).


>    printf("main is at %p\n", main);
>    printf("main is at %p\n", &main);
> }


If you have a function F, then:

    F()             Calls the function
    F               Yields its address
    &F              Yields its address

So F and &F do the same thing. In effect, the first line could also be 
written as:

    (&F)()          Calls the function

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

on confusing procedure names with the address of procedures Meredith Montgomery <mmontgomery@levado.to> - 2021-10-29 21:37 -0300
  Re: on confusing procedure names with the address of procedures Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-29 18:29 -0700
  Re: on confusing procedure names with the address of procedures Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-29 18:33 -0700
  Re: on confusing procedure names with the address of procedures Manfred <noname@add.invalid> - 2021-10-30 05:32 +0200
    Re: on confusing procedure names with the address of procedures James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-30 01:26 -0400
      Re: on confusing procedure names with the address of procedures Manfred <noname@add.invalid> - 2021-10-30 19:05 +0200
        Re: on confusing procedure names with the address of procedures James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-30 15:17 -0400
  Re: on confusing procedure names with the address of procedures Bart <bc@freeuk.com> - 2021-10-30 11:36 +0100
  Re: on confusing procedure names with the address of procedures Noob <root@127.0.0.1> - 2021-11-01 13:03 +0100

csiph-web