[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Skeleton angle brackets '<' and '>'
From: |
B.V. Raghav |
Subject: |
Re: Skeleton angle brackets '<' and '>' |
Date: |
Thu, 07 Jan 2016 09:33:49 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Hi Alan,
Alan Mackenzie <acm@muc.de> writes:
>
> Be careful what you want! Do you also want automatically to pair up
> "less than" with "greater than"? It could get pretty tedious if, every
> time you wanted to write "i < 10", you got "i <>", forcing you to delete
> the ">" before writing in the "10".
>
> This overloading of < and > with two meanings (actually, three when you
> count "#include <stdio.h>", but that causes few problems) causes great
> difficulties for C++ Mode. Only after extensive analysis can the mode
> determine that a < and a > are a pair of template delimiters, and even
> then, can't do it with 100% certainty.
>
> For example, how many parameters are passed to foo in the following:
>
> foo (a < b, c > d);
>
> ? It might be a function call with two relational expressions, it might
> be a declaration with the single parameter d of templated type a <b , c>.
> Such was the wisdom of C++'s designers.
>
> When it is determined there is a pair of delimiters, they are marked as
> such with syntax-table text properties, but this marking is always done
> on both delimiters at once.
>
> In short, there is little chance of ever being able to insert angle
> brackets as a pair in C++ Mode. Sorry!
Oh my, my! I totally forgot about the relational operator part! And the
elaborate explanation was highly insightful---a brilliant recap of the
C++ basics.
Thanks,
r
--
(B.V. Raghav)