(Un)compatibility between files generated from C++ and Java

M

Maria

Hi
is there (Un)compatibility between files generated from C++ and Java?
i think there is since the datatypes can have different
representation. In Java for instance integer type takes 4 bytes,
whereas it is just 2(i think!) in C++
so when writing in a language and reading the generated integer file
with other language mismatch occurs?

what about strings-type files (un)comaptibility between the two
languages?

is it worse between Java (C++) and Cobol/pascal?

if you can give me examples i 'll be delighted :)

thanks
 
J

Joona I Palaste

Maria said:
Hi
is there (Un)compatibility between files generated from C++ and Java?
i think there is since the datatypes can have different
representation. In Java for instance integer type takes 4 bytes,
whereas it is just 2(i think!) in C++
so when writing in a language and reading the generated integer file
with other language mismatch occurs?
what about strings-type files (un)comaptibility between the two
languages?
is it worse between Java (C++) and Cobol/pascal?
if you can give me examples i 'll be delighted :)

Files do not carry inherent notions of what created them. The exact same
kind of file can be created by Java, C++, COBOL, Pascal, assembler,
whatever.
It is true, as you say, that Java and C++ can have different-sized
integers, but this is not a problem. As long as you realise what sizes
different languages have for integers, you can develop a system of
always writing integers the same way. Every language has a way of
writing individual bytes. Just use this to write integers in a uniform
way across languages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top