News for hackers. Stuff that matters.
Re:Cdecl: C Gibberish ↔ English by jbandela1 on Saturday April 23, 2022 @11:30AM (#31135103)
If you are using C++, you can make this a lot easier using this template alias

   template<typename T>
   using ptr = T*;

   ptr<const char> str:
   const ptr<char> pchar;
   ptr<void(ptr<const char>)> fun_ptr;
   
Basically this simple trick removes most of the confusion, and you can read the types left to right.
Re:Cdecl: C Gibberish ↔ English by jcelerier on Saturday April 23, 2022 @11:53AM (#31135360)
It also makes function pointer types much clearer:

    using func_ptr = float(int);

    // Given
    float some_func(int);

    // Then
    func_ptr* a = &some_func;

    // Also
    func_ptr* b = [] (int x) { return 0.f; };