Have I to rewrite all the code using types for this purpose (qint32, etc)
Is there some macro or directive to to this work automatically ?
Maybe I'm looking something impossible ?
Thanks
Have I to rewrite all the code using types for this purpose (qint32, etc)
Is there some macro or directive to to this work automatically ?
Maybe I'm looking something impossible ?
Thanks
Hmm, QtCreator search and replace in all project files? Should do the trick.
Thanks ly.
It has a problem ? (change using qtcreator , i think ... ), all my simple vars used at for loops (in example) are going to changed ... I dont know if I need to do this.
And I have a doubt : can I compare or use a standard and QT typedefs ? In example :
And, what can I expect about the performance of my app ? That is, a windows app with int, double, etc are going to be faster than other that uses qint, qreal, etc. ?Qt Code:
int my_var_int; qint my_var_qint; if (my_var_int > my_var_qint) .... my_var_qint+=my_var_int; etc ...To copy to clipboard, switch view to plain text mode
Maybe better to write a code to translate data from one platform to another instead of having the whole app multi-platform writed ? (I'm talking about binary data files or streams ).
Thanks.
Your program won't be faster, but you also won't get troubles with platform type differences. The best way to write cross-platform application is to have the same code for all platforms
Oleg Shparber
Yes, but I'm talking about types...
Thanks
So.... Have I or not to write my code using qt typedefs ?All Qt types are C typedefs. So for the compiler there is no difference whether you write qint32 or signed int because it is defined qint32.
And a last question, the endianness is not fixed using qt typedefs isn't it ?
Thanks
Last edited by MarekR22; 15th November 2011 at 13:11.
For example : on smaller processors an int - might - be 16 bits instead of 32 bits, and then your programs won't work if you really need the 32 bits. And on a 64-bit processor, your program - might - behave differently if you rely on the 'overflow' of your numbers (e.g. If you expect that if you add 1 to 0xFFFFFFFF that you get 0x00000000).
But in many cases the C types have the same size for different platforms. I say 'many', not 'most' or 'all', so if you really want to be safe, then you should use qint etc.
Endianess is determined by the processor architecture. It is transparent to you (unless you start packing values in binary arrays, for which you should use QDatastream).
Regards,
Marc
tonnot (23rd November 2011)
Bookmarks