Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #89390

Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2)

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Bo Persson <bo@bo-persson.se>
Newsgroups comp.lang.c++
Subject Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2)
Date Thu, 2 Mar 2023 17:44:02 +0100
Lines 33
Message-ID <k6c22jFmg9aU1@mid.individual.net> (permalink)
References <ttqilb$b9c8$1@dont-email.me> <ttqips$b9c8$2@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net 7JEEYsBe70BYiBhkVZTjwwbGtLVcaBe8Nw0nZrpR4nyhl3dMkk
Cancel-Lock sha1:NWuvXKmln0klxcKc7mN08vCuD4I=
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0
Content-Language sv
In-Reply-To <ttqips$b9c8$2@dont-email.me>
Xref csiph.com comp.lang.c++:89390

Show key headers only | View raw


On 2023-03-02 at 17:27, MarioCPPP wrote:
> On 02/03/23 17:25, MarioCPPP wrote:
>>
>> I have this situation :
>>
>> int32_t * Pointer32; // is a 4 byte signed int
>> int8_t * Pointer8; // is a "signed char"
>> // pointer allegedly "unaligned".
>>
>> Pointer32 = new int32_t [10];
>> // supposedly ALIGNED a multiple of four byte addresses
>>
>> Pointer8 = static_cast <int8_t *> (Pointer32);
> 
> Using an old style casts deserves just a warning ...
> Pointer8 = (int8_t *) (Pointer32);
> 
> but it seems an ugly solution for a problem still not understood, so 
> please explain me the "ratio" of the error with static_cast
>

The problem isn't about alignment, but that the code uses a pointer to 
signed char. The standard allows inspecting bytes as unsigned char, but 
has no special allowance for signed char.


>>
>> ERROR : STATIC CAST FROM int * to signed char * IS NOT ALLOWED.
>>



Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

strange error (QT Creator 4.12.2, based on QT creator 5.14.2) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-02 17:25 +0100
  Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-02 17:27 +0100
    Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) Bo Persson <bo@bo-persson.se> - 2023-03-02 17:44 +0100
      Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-03-05 08:20 -0800
  Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) Andrey Tarasevich <andreytarasevich@hotmail.com> - 2023-03-02 09:44 -0800
    Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-02 23:37 +0100
      Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-02 17:03 -0800
        Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-03 13:22 +0100
          Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-03-03 09:29 -0800
            Re: strange error (QT Creator 4.12.2, based on QT creator 5.14.2) MarioCPPP <NoliMihiFrangereMentulam@libero.it> - 2023-03-04 22:53 +0100

csiph-web