Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #169230
| Path | csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
| Newsgroups | comp.lang.c++, comp.lang.c |
| Subject | Re: lvalue assignment difference between C and C++ |
| Date | Wed, 08 Feb 2023 22:12:38 -0800 |
| Organization | None to speak of |
| Lines | 35 |
| Message-ID | <87wn4rcqp5.fsf@nosuchdomain.example.com> (permalink) |
| References | <trltmg$21cft$1@dont-email.me> <0mvDL.68810$b7Kc.34465@fx39.iad> <trm2tb$224hr$1@dont-email.me> <tro15s$2f7lc$1@dont-email.me> <trqh4c$31588$1@dont-email.me> <87r0v2ecc0.fsf@nosuchdomain.example.com> <trt5cs$3gvt8$1@dont-email.me> <87edr1e1js.fsf@nosuchdomain.example.com> <ts1ocr$hffi$1@bluemanedhawk.eternal-september.org> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | reader01.eternal-september.org; posting-host="8191dc9d3cc9a723636202e99e75b43d"; logging-data="629235"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LMYc2gpgf6oe1t8xgSL0B" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
| Cancel-Lock | sha1:H0iKgvQKGLLo90OC7szfmHhvBQQ= sha1:cdy1kYyUQ7ffAC9UXAtS8ogpn2k= |
| Xref | csiph.com comp.lang.c++:89055 comp.lang.c:169230 |
Cross-posted to 2 groups.
Show key headers only | View raw
Blue-Maned_Hawk <bluemanedhawk@gmail.com> writes:
> On 2/7/23 14:08, Keith Thompson wrote:
>> Muttley@dastardlyhq.com writes:
>>> On Mon, 06 Feb 2023 13:03:11 -0800
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> [...]
>>>> C's grammar is not trivial to parse, due to typedefs. A typedef
>>>> effectively creates a context-specific keyword, which means the parser
>>>> has to interact with the symbol table. (Historically, this is because
>>>> typedefs were introduced relatively late in the evolution of C.)
>>>
>>> Could it not cheat and simply treat a typedef as a kind of macro?
>> No, typedefs have scope, and a declaration in an inner scope can
>> hide a
>> typedef in an outer scope.
>
> So could it treat it as a macro that gets `#undef`ed at the end of a scope?
No, that wouldn't even work for the example I posted. The "macro"
wouldn't be undefined until the end of main.
#include <stdio.h>
int main(void) {
typedef int Integer;
{
int Integer = 10;
printf("Integer = %d\n", Integer);
}
// int Integer = 20; // would be a syntax error
}
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
lvalue assignment difference between C and C++ Muttley@dastardlyhq.com - 2023-02-04 15:30 +0000
Re: lvalue assignment difference between C and C++ Richard Damon <Richard@Damon-Family.org> - 2023-02-04 11:04 -0500
Re: lvalue assignment difference between C and C++ Muttley@dastardlyhq.com - 2023-02-04 16:59 +0000
Re: lvalue assignment difference between C and C++ Richard Damon <Richard@Damon-Family.org> - 2023-02-04 13:02 -0500
Re: lvalue assignment difference between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-04 12:45 -0800
Re: lvalue assignment difference between C and C++ David Brown <david.brown@hesbynett.no> - 2023-02-05 11:42 +0100
Re: lvalue assignment difference between C and C++ Muttley@dastardlyhq.com - 2023-02-06 09:26 +0000
Re: lvalue assignment difference between C and C++ David Brown <david.brown@hesbynett.no> - 2023-02-06 14:13 +0100
Re: lvalue assignment difference between C and C++ Muttley@dastardlyhq.com - 2023-02-06 15:50 +0000
Re: lvalue assignment difference between C and C++ David Brown <david.brown@hesbynett.no> - 2023-02-06 20:08 +0100
Re: lvalue assignment difference between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-06 12:47 -0800
Re: lvalue assignment difference between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-06 13:03 -0800
Re: lvalue assignment difference between C and C++ Muttley@dastardlyhq.com - 2023-02-07 09:24 +0000
Re: lvalue assignment difference between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-07 11:08 -0800
Re: lvalue assignment difference between C and C++ Muttley@dastardlyhq.com - 2023-02-08 09:23 +0000
Re: lvalue assignment difference between C and C++ Blue-Maned_Hawk <bluemanedhawk@gmail.com> - 2023-02-08 22:13 -0500
Re: lvalue assignment difference between C and C++ James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-02-08 22:53 -0500
Re: lvalue assignment difference between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-08 22:12 -0800
Re: lvalue assignment difference between C and C++ Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-02-08 02:52 +0000
Re: lvalue assignment difference between C and C++ Paavo Helde <eesnimi@osa.pri.ee> - 2023-02-06 09:11 +0200
Re: lvalue assignment difference between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-06 01:01 -0800
Re: lvalue assignment difference between C and C++ Richard Damon <Richard@Damon-Family.org> - 2023-02-06 07:42 -0500
Re: lvalue assignment difference between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-06 12:59 -0800
Re: lvalue assignment difference between C and C++ bart c <bart4858@gmail.com> - 2023-02-06 08:11 -0800
Re: lvalue assignment difference between C and C++ Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-02-06 21:19 +0000
Re: lvalue assignment difference between C and C++ Bonita Montero <Bonita.Montero@gmail.com> - 2023-02-07 07:44 +0100
Re: lvalue assignment difference between C and C++ Paavo Helde <eesnimi@osa.pri.ee> - 2023-02-07 09:18 +0200
Re: lvalue assignment difference between C and C++ Kaz Kylheku <864-117-4973@kylheku.com> - 2023-02-06 22:21 +0000
Re: lvalue assignment difference between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-06 14:43 -0800
Re: lvalue assignment difference between C and C++ Paul N <gw7rib@aol.com> - 2023-02-07 03:17 -0800
Re: lvalue assignment difference between C and C++ Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-02-07 16:25 +0000
Re: lvalue assignment difference between C and C++ Paul N <gw7rib@aol.com> - 2023-02-08 13:19 -0800
Re: lvalue assignment difference between C and C++ Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-02-08 23:46 +0000
Re: lvalue assignment difference between C and C++ Bonita Montero <Bonita.Montero@gmail.com> - 2023-02-04 19:41 +0100
Re: lvalue assignment difference between C and C++ Andrey Tarasevich <andreytarasevich@hotmail.com> - 2023-02-10 16:19 -0800
csiph-web