belgesel
Joined 6 years ago
Karma
21
Submissions
28
Member since
Jan 17
Joined 6 years ago
I would rather see both of these compilers to stay competitive to push themselves higher.
struct my_struct{int a; char private[10];}
void * get_struct_field_nonconst(struct my_struct *ptr)
{ return &(ptr->private[0]); }
With these elements you are only allowed to give non-const pointers to read or write inside private field.
In order to truly apply this to const pointers (no casting etc.) you will need another get_struct_field() function but defined as this. const void * get_struct_field_const(const struct my_struct *ptr)
{ return &(ptr->private[0]); }
This will work but it is ugly. Here _Generic keyword allows you to write these functions but use them with a common name. Such as get_struct_field(). And that would be something like this: #define get_struct_field(ptr) \
_Generic((ptr), \
const struct my_struct * : get_struct_field_const, \
struct my_struct * : get_struct_field_nonconst) \
(ptr)
Hope this would help!
When I see the term "ice-cream", I think of cold white creamy thing on a cone that you can buy from fast food chains. That is different from what we call "dondurma" here in Turkey. That is much softer and more creamy than "dondurma".
Turkish people probably saw the dessert from Europeans. At least that's what Nisanyan says.
https://www.nisanyansozluk.com/kelime/dondurma