poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Changing the unit of an offset


From: Bruno Haible
Subject: Re: [RFC] Changing the unit of an offset
Date: Sun, 07 Feb 2021 12:05:40 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

Hi José,

> If we were to have an alternate shoter syntax for that offset, what
> about this:
> 
>    offset##UNIT

I would not use '#' or '##' in another syntax. As you just said, what
we are talking about here is a variant of cast (i.e. 'as'). But the
primary purpose of '#' is to designate a unit.

The history of C++ has shown that using the same operator or keyword
for multiple purposes (especially unrelated purposes!) makes programs
hard to understand. For example, in C++:
  <  <<       comparison, shift, template type(!), template instantiation(!)
  ::          namespace, member of struct/class type
  = 0         initializer, assignment, virtual function(!)
  [ ]         array declaration, array element reference, attribute(!)
  const       read-only variable, member function that does not modify *this
  default     switch label, special member function
  static      storage duration of variables, absence of this parameter (!)
  extern      linkage of variables, instantiation of templates (!)

Therefore my advice is: Use operators and keywords for just ONE PURPOSE
each.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]