Could FreeBASIC replace C

General FreeBASIC programming questions.
TheMG
Posts: 376
Joined: Feb 08, 2006 16:58

Postby TheMG » Mar 01, 2006 14:33

Ye it isnt needed much, but it is faster and smaller (and also powerful, but most are just as). And thats what Id count as the most powerful language.
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Postby 1000101 » Mar 01, 2006 14:39

Generally speaking, the worst code an optimizing compiler will produce will outpreform the best code an average assembly programmer will produce.

It takes a *lot* of talent to write good, fast, assembly. If you do it wrong, it will be slow. Very slow. There is more to assembly then simply instruction timings. Infact, instruction timings play very little part in the role of the speed of code. More important things are prefetch timings, bus latency and cache usage. There are more things and that accentuates my point. I'm an average assembly programmer. I forget little things like that. An optimizing compiler does not forget these things and will generate assembly which will preform the fastest given what I want. You really have to understand how the system works before you can start saying anything about how well assembly will preform compared to an optimizing compiler (and there are virtually no high-level compilers which aren't optimizing in some way).
TheMG
Posts: 376
Joined: Feb 08, 2006 16:58

Postby TheMG » Mar 01, 2006 14:55

But thats basing speed on programmers ability.
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Postby 1000101 » Mar 01, 2006 15:16

TheMG wrote:But thats basing speed on programmers ability.


No, it's basing speed on reality. Assemblers do no optimizations, they can't or they could change the intended functionality of the code. When dealing with assembly, you have to do all the optimizations yourself. With high-level languages optimization at the programmer level takes place in algorithms, not code output. That is the point of modern languages. That the programmer can work on the abstract (better algorithms) and let the compiler deal with the concrete (better code).

Once you take some CS classes in university you will learn all these wonderful things. Or, alternatively, if you find books on the subject you will all find they same the same basic thing to what I just said and have said all along. I, nor these books, nor university professors say these things because we want you to feel as if your thoughts are wrong. We are stating these things because they are simple truths. You will never write assembly as well as the best optimizing compiler and there is no point in trying. Concentrate on algorithms in a HLL and only drop to asm when your algorithm is as sound as possable. Most optimizations can be preformed at the high-level much more effectively then the low-level. Writing a bubble-sort in assembly using SSE3 for an x64 won't help. It's still the same clunky bubble sort. A better sorting method would yield faster results in unoptimized C. Don't jump on the "OMG! ASM SI TEH 1337Z0R5!" bandwagon. Assembly has it's places, it's the ability of the programmer to use the tools he has to determine if there is a better solution (algorithm) or if his algorithm is as good as he can make it and then taking a look at the assembly output for the algorithm and seeing if he can improve it. Don't waste time polishing and waxing your square wheel. A clunkly round wheel will do the job a lot better then the square wheel will, no matter refined it is.
Mysoft
Posts: 780
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Postby Mysoft » Mar 01, 2006 15:24

omg, what a discussion here, i think in that way, when FB can supoort OO code and have an good IDE like in C++,Delphi and VB, the company's that use VB can migrate to FB, but not all, cuz, simples they don't want to migrate... but the newest company's can use FB, and expand it, however i consider fb a superior language at now, cuz, have speed, simplicity, and have much power, dispite of the OO object, and i think that FB have future, but for many people "BASIC" means a basic language, and they are wrong >.<
Mysoft
Posts: 780
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Postby Mysoft » Mar 01, 2006 15:49

and for the assembly speed, most of you say is word of mad programmers, generaly, assembly have a diferente logic of programmming, is the same diference between program a script languagem and a compiler language, asm have a diferent way to think when programmin, but a good program, know what running in the background of your HL language, to best optimize it, and is many, really many cases, simples asm codes. that doesnt evolve out I/O except memory, can do some things really fast, and in the end, ASM dont need to be a language alone, but it extremely useful and important, mixing asm with your HL language, if you want speed codes, and NO way the compiler will do it, since he cannot supress temporary variables used in optimized codes, that in asm you can put them in registers directly, this is what i think about it ^^
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Re: Could FreeBASIC replace C

Postby v1ctor » Mar 01, 2006 15:55

RayBritton wrote:Hi, i was wondering could FreeBASIC replace C as the number 1 language. Or are they things that C can do and FreeBASIC can't yet.


No, the plan is to replace every single BASIC language known to man.

Seriously, FB was started to be an alternative to QuickBASIC, it wasn't created to replace anything, i thought it would have a couple of users, what it reached in just one year is incredible already.
Z!re

Postby Z!re » Mar 01, 2006 15:59

[Content removed at author's request]
TheMG
Posts: 376
Joined: Feb 08, 2006 16:58

Postby TheMG » Mar 01, 2006 16:04

It would be brilliant if it could compile to pure OS stuff (completely standalone - the word escapes me). Just a dream though.
VirusScanner
Posts: 775
Joined: Jul 01, 2005 18:45

Postby VirusScanner » Mar 01, 2006 16:12

That would be pretty impossible - the compiler would have to emit a bootloader, have its own drivers for graphics, networking, printing, USB, and any other devices. You get the idea.

But using FB to build an OS... that would be interesting.
PlayerOne
Posts: 173
Joined: Aug 15, 2005 18:58
Location: UK

Postby PlayerOne » Mar 01, 2006 16:12

This thread degenerated fast. :-)

I assumed "number 1 language" meant most popular language. It could still be C, it probably depends what you include. It's probably C++ on most desktop OS's. A lot of the time it is C++ in the style of C. ;-)

I don't really regard Assembly as a language, more a family of languages. It is quite possible to know 68K Assembly and not know Intel Assembly, for instance. (It is much easier not to know Intel Assembly, it seems to be a horrible mess :-)).
TheMG
Posts: 376
Joined: Feb 08, 2006 16:58

Postby TheMG » Mar 01, 2006 16:16

It could be done (FB for OS). Becuase it is open source, and thereis a community. If we all helped it may be possible. Sadly that will never happen.
VirusScanner
Posts: 775
Joined: Jul 01, 2005 18:45

Postby VirusScanner » Mar 01, 2006 16:21

"It could be done"
Yes, sure, if you want to distribute a 400MB "Hello world" program. If the rtlib contained all the drivers like windows or linux has...

I still like the idea of an OS written in FB though. I don't know how hard it would be, since FB requires its rtlib, but then again, C's rtlib has to be ported for a new OS written in C too... maybe...
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Re: Could FreeBASIC replace C

Postby anonymous1337 » Mar 01, 2006 16:27

v1ctor wrote:i thought it would have a couple of users, what it reached in just one year is incredible already.
<off-topic>That worries me...Will you be less active in the forums when it becomes the new leading, and even more well-known BASIC compiler out there?</off-topic>

*thinks of FB replacing VB*, - Every, basic known to man. VB too?

@Making an OS in FB:

There were so many failed attempts in QB, and maybe one or two half-decent ones. I'm surprised there isn't already one in FB. (all fake os's by the way from what I remember). . . Lol. "My new OS runs on Windows"
hippy
Posts: 84
Joined: Nov 04, 2005 18:13
Location: UK

Postby hippy » Mar 01, 2006 16:41

PlayerOne wrote:I assumed "number 1 language" meant most popular language. It could still be C, it probably depends what you include.

Again we still have a problem with the definition of "most popular". I've heard it said that more lines of VB have been written than C or C++, but don't know how true that is ( and what's a line of code ! ). Have more lines of COBOL been written, and how much is still in use ? FORTRAN ? What time periods are we refering to ?

There is no simple answer to the questions of most popular, best etc because the question and answer needs to be put into context. One attempt to put this into perspective is http://www.tiobe.com/tpci.htm - They have Java at the top, and have done, on and off, for a while, but only on the criteria they choose to measure with. Use different criteria and there will undoubtedly be different answers.

There might be a language which meet more criteria better than any others, but what are those criteria, are they valid, or necessities. It's an interesting area for philosophical debate, but that's all.

Return to “General”

Who is online

Users browsing this forum: albert, Baidu [Spider], fxm and 11 guests