You are not logged in.

#1 2010-05-07 18:57:57

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

[Solved] Programming language independependent from platform.

Hello all!
I want to ask you ,a question.
Is there any platform independent programming laguage execpt Interpredet Luanguages , Java ,  D, JVM Based too (using JVM to run), and ASM ?
You know, I write code for example on Linux and move the code to Windows and it will work without integrating in the source code.
I don't mean languages like JS , or ECMA-Script.

Last edited by SpeedVin (2010-05-10 15:16:54)


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#2 2010-05-07 19:57:53

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: [Solved] Programming language independependent from platform.

Sure, most high-level languages.  C, C++, Python, Perl, Scheme, FORTRAN.  Assembler (which is what I presume you mean by ASM) is not platform independent.  Unless you're using a different definition of "platform" than I am.

Offline

#3 2010-05-07 20:49:59

Rip-Rip
Member
Registered: 2008-11-09
Posts: 32

Re: [Solved] Programming language independependent from platform.

Well, every langages are portable. Only the libs are not, so if you want to be portable, you should use
a portable library. For exemple using system call, like open, read, write on Linux is not advised, since
Windows use different system call smile

Offline

#4 2010-05-07 21:46:18

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [Solved] Programming language independependent from platform.

Which all translates to "Hello world!"

Happy hacking. big_smile


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#5 2010-05-07 22:59:20

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: [Solved] Programming language independependent from platform.

Assembly is the polar opposite of platform independent.  In fact, on second look not a single one of the languages you mentioned are what I would describe as interpreted (the closest being Java).
As for the question, as far as I know you're not going to find compiled languages that are platform independent in the way you describe unless you count bytecode languages such Java.

Last edited by cmtptr (2010-05-07 23:03:48)

Offline

#6 2010-05-08 01:54:54

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Programming language independependent from platform.

There are a number of languages that are cross platform. C, C++, and Fortran have been mentioned. Haskell and OCaml are too. If you write against cross platform GUI toolkits like wxwidgets, QT and GTK2, it will take you a long way.

Offline

#7 2010-05-08 08:38:09

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: [Solved] Programming language independependent from platform.

cmtptr wrote:

Assembly is the polar opposite of platform independent.  In fact, on second look not a single one of the languages you mentioned are what I would describe as interpreted (the closest being Java).
As for the question, as far as I know you're not going to find compiled languages that are platform independent in the way you describe unless you count bytecode languages such Java.

You are right smile
Can you say more about it?
(I mean ASM and platform independent).
Trent:
You mean that some other types of ASM have diffrent syntax?
Rip-Rip:
You are right and I want a language that will give me the same lib's on the same system's.
About the C/C++ I writted program that will won't work on Linux and will only work on Windows becouse in Windows you have some lib's that thanks to them the program can be compiled ,and if I want to run it on Linux I have to rewritte most of the code sad


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#8 2010-05-08 13:47:54

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: [Solved] Programming language independependent from platform.

I don't know what you mean by "ASM".  If by that you mean assembly language, then yes, there are many different assembly languages.  I am distantly familiar with the assembly language of some obsolete 8-bit Atmel processor.  Someone with more experience writing assembly for PCs can inform you more accurately than I can.

If you compiled a program on Windows that won't compile on Linux, that's probably because you used the Microsoft Visual C++ toolchain, which is not standards-conforming and provides extensions for which there is no Linux equivalent -- conio.h comes to mind, for which the curses library is a more portable replacement.

Offline

#9 2010-05-08 17:13:55

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: [Solved] Programming language independependent from platform.

SpeedVin wrote:
cmtptr wrote:

Assembly is the polar opposite of platform independent.  In fact, on second look not a single one of the languages you mentioned are what I would describe as interpreted (the closest being Java).
As for the question, as far as I know you're not going to find compiled languages that are platform independent in the way you describe unless you count bytecode languages such Java.

You are right smile
Can you say more about it?
(I mean ASM and platform independent).

I'm not sure what more there is to say.  The concept of platform independence is built on abstraction, and assembly (by definition!) is not abstracted at all.  It's the most low-level, what-you-see-is-what-you-get language there is (I guess next to pen and paper assembling or punch cards?).  As Trent has mentioned, the instruction set is different for every architecture.  I personally have experience with 8051 and MIPS assembly, and I'm reasonably familiar with x86(_64) assembly; each one is noticeably different.  Furthermore, aside from hardware architecture, the low-level system calls you'd make to the OS are not going to be the same between Windows and Linux.

If you want platform independence without compiling, you've really immediately narrowed your selection down to either scripted languages or interpreted languages.
And ignore what I said earlier about Java not being an interpreted language.  That was me being dumb and mixing up words.

Last edited by cmtptr (2010-05-08 20:19:48)

Offline

#10 2010-05-08 17:36:21

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Programming language independependent from platform.

If one stays within the standard, then all of the languages that I mentioned above are cross platform. The problem comes when people start using propriety off-shoots like Visual C++, which has deviated far from the standards. Yes, there are different underlining structures within each OS, but it's the compiler and cross platform library writer's job to abstract that away.

Offline

#11 2010-05-08 17:37:40

SoleSoul
Member
From: Israel
Registered: 2009-06-29
Posts: 319

Re: [Solved] Programming language independependent from platform.

Isn't Haskell totally cross platform?
EDIT: Well, the question should be: Isn't the whole library cross platform?
About a GUI toolkit, I'm afraid Haskell isn't exceptional here. You'll have to use a cross-platform toolkit as mentioned before.

Last edited by SoleSoul (2010-05-08 17:40:58)

Offline

#12 2010-05-08 17:40:38

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Programming language independependent from platform.

SoleSoul wrote:

Isn't Haskell totally cross platform?

Yes. In fact, I read somewhere that Windows version of GHC runs perfectly under Wine. How fun is that?

Offline

#13 2010-05-08 20:20:12

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: [Solved] Programming language independependent from platform.

Maybe I misunderstood the question.  I thought he wanted platform independence without recompiling?

Offline

#14 2010-05-08 21:14:35

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [Solved] Programming language independependent from platform.

cmtptr wrote:

Maybe I misunderstood the question.  I thought he wanted platform independence without recompiling?

Nah, SpeedVin is looking for code portability. English is not SpeedVin's first language, so there's a little bit of that going on.

Offline

#15 2010-05-09 08:26:34

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: [Solved] Programming language independependent from platform.

Wow skottish thanks for this answer.
I'm sorry for my English ,and I am still learning.
BTW.Like skottish said I'm looking for code portabilty.
I will try Haskell.
But what do you think about Clojure?

Last edited by SpeedVin (2010-05-09 08:33:54)


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#16 2010-05-09 08:38:53

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: [Solved] Programming language independependent from platform.

Clojure runs on the java virtual machine, according to your first post, it's not what you want


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#17 2010-05-09 08:44:16

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: [Solved] Programming language independependent from platform.

moljac024 wrote:

Clojure runs on the java virtual machine, according to your first post, it's not what you want

But the code protability is great on it when I will have JRE installed...
I'm right?

Last edited by SpeedVin (2010-05-09 08:44:48)


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#18 2010-05-09 12:32:13

bruce
Member
Registered: 2008-11-27
Posts: 57

Re: [Solved] Programming language independependent from platform.

Yep, its also a kind of fun language (IMO)

Offline

#19 2010-05-09 18:45:19

yngwin
Member
Registered: 2009-05-08
Posts: 67

Re: [Solved] Programming language independependent from platform.

Qt is one of your best options for cross-platform compatibility.

Offline

#20 2010-05-10 15:16:34

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: [Solved] Programming language independependent from platform.

Okay thank you guys I think contest for the best code protable compiled language wins:
-Languages using JVM
-Haskell
-D
(Random order).


Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

Board footer

Powered by FluxBB