Re: AW: AW: Correct way to express to the compiler "this does not get clobbered"?

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

 



"Stefan Franke" <s.franke@xxxxxxxxxxxx> writes:

[...]

> I disagree:
>
> typedef struct {
>    void (* const fun_ptr)(void);
>    const long x;
>  } x_t;
>
> Declares that fun_ptr and x both are const and cannot change. So these const value can safely be propagated out of loops if the pointer to is also const and can't change. The current compiler simply ignores that knowledge.
>
> I cannot judge if this is a bug or a not implemented feature. But in the current implementation only the c/c++ parser cares about const whereas the compiler passes do not check constness.

You might be right if you change the code this way, but to begin with
how do you set 'fun_ptr' if the only way to access it is through a
pointer to const?  I suspect this is not very much a realistic case.

  Andrea



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux