Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
11.3: How many 'levels' deep?
#6
Question for qualified type and unqualified type.

(1)What is unqualified type and qualified type in the following code?
(2)Is this code compliant with rules?

Code:
typedef const struct a{
  int32_t av = 0;
}A;

typedef const struct b{
  int32_t bv = 0;
  int32_t bv2 = 0;
}B;

void func(A *a)
{
・・・
}

int32_t main(){
A aa;
B bb;
func((*A)&bb);
}
According to ISO/IEC 9899:2011 chapter 6.2.5(type),each unqualified type has a qualified type
corresponding to a combination of qualifiers such as const.
Therefore, it can be interpreted that const qualified unqualified type becomes qualified type.

In this code, the structure is const qualified, so it may be a comparison between qualified types.
If that is correct, this is the compliance code.
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)