lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #49827] wrong cast to size_t on 16-bit x86 architectur


From: Ambroz Bizjak
Subject: [lwip-devel] [bug #49827] wrong cast to size_t on 16-bit x86 architecture
Date: Mon, 12 Dec 2016 21:35:33 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.90 Safari/537.36

Follow-up Comment #11, bug #49827 (project lwip):

Simon,

Why do you think there is a problem? Do you get a compiler error or warning?

It is a common misconception that casting "const T *" to "T *" is invalid. But
in reality it is perfectly valid by itself. What is invalid is using the
latter to modify a pointed-too object which is read-only (e.g. a string
literal or an object declared with const; note it IS valid to modify an object
which is not read-only).

I could go quoting standards but I assume I won't change your mind that way :)
Here's a StackOverflow answer though it fouces on C++:

http://stackoverflow.com/questions/8570139/is-a-cast-from-pointer-to-const-to-pointer-to-non-const-invalid-c

It is then also obviously valid to cast the "T *" to "void *". And it should
also be perfectly valid to cast "const T *" directly to "void *".

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?49827>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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