[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compiling with xlc
From: |
Bruno Haible |
Subject: |
Re: compiling with xlc |
Date: |
Tue, 02 Mar 2021 23:12:50 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; ) |
Hi Luca,
> > 1506-120 (W) Function cannot return a const qualified type.
>
> I am actually not sure about this one; is it because the returned union
> has a pointer-to-const member?
It's because the function returns a 'const <some_struct>'. If you change the
return type to '<some_struct>', the warning goes away.
Remembering that the return value of a function, in C, can be copied anyway
before it's assigned to its destination, the 'const' cannot prevent this
copying. So it is redundant.
Bruno