[cfe-dev] [llvm-dev] Modernizing LLVM Coding Style Guide and enforcing Clang-tidy

Sanjoy Das via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 9 14:58:49 PST 2017


Hi,

Sorry I fat fingered an earlier send in the previous email.  I was
trying to say:

On Mon, Jan 9, 2017 at 2:52 PM, Sanjoy Das
<sanjoy at playingwithpointers.com> wrote:
>> +1 Exactly this.
>> I don't think C programmer will not understand using. The "=" makes it much
>> simpler to read, even if it is the first time you see it, which is not the
>> case of typedef.
>>
>> typedef MyType::NestedType (*fptr)(const MyOhterType&);
>> or
>> using fptr = MyType::NestedType (*)(const MyOhterType&);
>

I would prefer to please keep using typedefs at least for function
pointers.  I find either of

typedef MyType::NestedType (*fptr)(const MyOhterType&);

or

typedef int fptr(const int&);

void f(fptr* ptr) {
  ...
}

easier to read than the "using" declaration (especially the second
form, with the explicit `fptr* ptr`).

-- Sanjoy



More information about the cfe-dev mailing list