lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #9876] Const-correctness fixes, pointer types for bu


From: Freddie Chopin
Subject: [lwip-devel] [patch #9876] Const-correctness fixes, pointer types for buffers & couple minor tweaks
Date: Fri, 6 Dec 2019 02:07:34 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

Follow-up Comment #2, patch #9876 (project lwip):

[comment #1 comment #1:]
> void* and u8_t* is basically the same thing

Unless you are using C++, in which case they are not. When the API requires an
u8_t* and you have a void*, then you have to use `static_cast<u8_t*>()`,
otherwise the compiler produces an error.

> and adding some const hints to compiler. It does not fix any issue, does not
add a feature

Unless you are using C++, in which case removing `const` has to be a separate
step from converting the type and now your calls to lwIP APIs are starting to
look a bit ridiculous:

pppos_input_tcpip(pcb_, static_cast<u8_t*>(const_cast<void*>(buffer)), size);

In my opinion the lack of `const` is a type error in PPP code, therefore I
wouldn't call it "a hint" or "a cosmetic change". The "feature" this adds is
relieving the user from having to cast everything all over the place. Note
that this even allows removing a few casts from within PPP code, which were
required only because PPP used different type (u8_t*) than the rest of lwIP
(void* in payloads)

Final decision is obviously yours (;

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9876>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

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