Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.c Subject: Re: question about linker Date: Tue, 03 Dec 2024 11:15:44 +0000 Organization: A noiseless patient Spider Lines: 23 Message-ID: <87ldwx10gv.fsf@bsb.me.uk> References: <87plmfu2ub.fsf@nosuchdomain.example.com> <87frnbt9jn.fsf@nosuchdomain.example.com> <877c8nt255.fsf@nosuchdomain.example.com> <20241129142810.00007920@yahoo.com> <20241129161517.000010b8@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Tue, 03 Dec 2024 12:15:45 +0100 (CET) Injection-Info: dont-email.me; posting-host="cf531b1cb672484e0c9ec8f5ba375d45"; logging-data="25717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18b90RywwTnKqRN1cvh7EzGHIBUHjVuYaY=" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:uEFlgEGaa/eMjpUYVedxv6qpsGA= sha1:6n6KI9RWq5kVUaiHenlpGyld+T4= X-BSB-Auth: 1.0ccba0a4f4cb4fabc54f.20241203111544GMT.87ldwx10gv.fsf@bsb.me.uk Bytes: 2303 Bart writes: .... > If I write this > > int *A, B[10], C(int); > > My compiler tells me that: > > A is a local variable with type 'ref i32' (expressed in other syntax) > B is a local variable with type '[10]i32' > C is a function with return type of 'i32', taking one unnamed > parameter of type 'i32'. > > (Interestingly, it places C into module scope, so the same declaration can > also create names in different scopes!) A small correction: that declaration gives all three names the same scope[1]. You are confusing scope with linkage. [1] Well almost the same. The scope of A includes the declarators for B and C, and the scope of B includes the declarator for C. -- Ben.