[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t)
From: |
Simon Goldschmidt |
Subject: |
[lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t) |
Date: |
Fri, 14 May 2010 10:50:54 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 |
Follow-up Comment #46, bug #27352 (project lwip):
Well, of course I can create an unaligned u32_t pointer if I want to. In
fact, lwIP does this trick in some places and ensures correct alignment by
adding its own defines. However, if I don't take the detour of using a
void-pointer, the compiler warns me:
u8_t *a = &some_u8t;
u32_t *b = (u32_t*)a; <<-- compiler warns
u32_t *c = (u32_t*)(void*)a; <<-- compiler doesn't warn
If we only used the 1st cast, what could go wrong? How could it give an
unaligned type? An of course, the next lines give warnings, too:
typedef u32_t some_type_t;
some_type_t *d = (some_type_t)a;
So far so good. However, I would have expected to be warned when casting from
a (possibly) unaligned u32_t member of a packed struct to an u32_t pointer
(that requires alignment), but it seems I have been wrong there.
Being like that, we need some other guards here to prevent creating unaligned
pointers.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?27352>
_______________________________________________
Nachricht geschickt von/durch Savannah
http://savannah.nongnu.org/
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Simon Goldschmidt, 2010/05/12
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Bill Auerbach, 2010/05/12
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t),
Simon Goldschmidt <=
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), David Empson, 2010/05/16
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), David Empson, 2010/05/16
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Simon Goldschmidt, 2010/05/17
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Kieran Mansley, 2010/05/18
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Simon Goldschmidt, 2010/05/18
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Bill Auerbach, 2010/05/18
- Message not available
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Bill Auerbach, 2010/05/19
- Message not available
- Message not available
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Bill Auerbach, 2010/05/19
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Bill Auerbach, 2010/05/19
- Message not available
- [lwip-devel] [bug #27352] Change ip_addr from struct to typedef (u32_t), Bill Auerbach, 2010/05/19