why is it always c or cpp

New to FreeBASIC? Post your questions here.
marcov
Posts: 2938
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Postby marcov » Aug 15, 2008 7:43

arenth wrote:
marcov wrote:
arenth wrote:...
For example comparing FB and gcc.
C is faster. (Optimizing compiler)


I think you should differentiate between "optimizes better in this and this situation because of historic bagage", and "this language is faster than that because average use needs less helpers".

...


Actually it remains a valid and accurate point, FB does not optimize anywhere near as much as something like gcc, and therefore on an average basis, even near equivalent code will run faster in C then FB.


And you make exactly the same mistake again. Saying C when you mean gcc. There is a difference when comparing languages and comparing implementations.

Its not really that important of an issue, and wasn't intended to elicit any sort of response. Simply put, its an edge (albeit a tiny one) C has over FB in that very specific field.


I know C interpreters that are way slower than FB, so Basic is faster than C?
tincrowdor
Posts: 9
Joined: Aug 07, 2008 6:26

Postby tincrowdor » Aug 16, 2008 6:22

My experience with C and C++ dates back 10 years when I did a short training course. I felt the syntax was more "basic" than expected but instead of concentrating on getting program structures correct a lot of the time was spent checking for missing semi colons and end brackets. As for getting something useful for coding games it was a giant uphill struggle. My philosophy is code in the highest level language you are comfortable with and if the program needs speeding up or tweaking then try optimizing the code and only then try lower level languages to help. To be honest I'd rather learn about assembly language than C
arenth
Posts: 511
Joined: Aug 30, 2005 6:22

Postby arenth » Aug 17, 2008 2:15

@marcov You are argueing a completely semantic point simply to fight an arguement that really isn't there. Yes when I say C I mean gcc, and thats because 90%(exaggeration and in no way represents a real number) of the world that still uses C uses gcc. Sure there is a tiny collection of C interpreters, and sure they are slow however, when it ultimately comes down to it, when people are comparing C to FB, it is in fact gcc to FB. Which is Something I did also point out somewhat specifically in my post by comparing FB to gcc, and not the C spec. So the point still remains entirely valid.

You still of course missed the whole point of my original post. Which is that people tend to look at a few domain specific, somewhat arbitrary points when comparing language (a) with language (b). In this case I chose to compare the speed of one vastly majority implementation of C, vs the only implementation of FB. Now we are having a pointless arguement about some pointless semantic.
counting_pine
Site Admin
Posts: 6190
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Aug 17, 2008 3:34

It doesn't make sense to compare C and BASIC based on speed. It's possible to write an implementation of BASIC that's faster than an implementation of C, and vice versa.

Why is GCC make faster programs than FB? Because it's been in production longer and has a dedicated, knowledgeable team that's made up of more than 7 members. A lot of this team are also no doubt very well versed in compiler theory, and don't have distractions such as an extended runtime and multiplatform graphics library to maintain.

The speed difference will probably become largely irrelevant anyway, if/when FB gets completes its GCC emitter.

I guess the real question is why they decided to make a C compiler, rather thana BASIC compiler, in the first place. Which boils down to why C was the better choice than BASIC.

I suspect it was mainly the fact that the specifications of C were simpler, meaning less namespace pollution, and also fewer compatibility issues between implementations; and that it's more low-level, featuring pointers and assembly (?) built into the original specification, and so allowed for better efficiency in terms of speed and memory management, and fewer dependencies for really low-level work, such as operating system internals.
Mysoft
Posts: 776
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Postby Mysoft » Aug 17, 2008 9:11

even knowing that this is right... this sound lazynes... "let's do a C compiler cuz is easier to make a new C compiler for other plataforms... cuz it does nothing else except the basic"

but i guess that CRT is a C lib.... which is bad, even for a optimized compiler... (portability?)

again, lazyness... cuz you dont need to make a compiler each time you make a app :P
jevans4949
Posts: 1151
Joined: May 08, 2006 21:58
Location: Crewe, England

Postby jevans4949 » Aug 17, 2008 15:48

Mysoft: I wouldn't say that implementing a C compiler is necessarily a matter of laziness.

The original Unix and C implemetation was by a bunch of real propellor-heads, who were looking for something compact to run on a old computer that was lying around their office. What they came up with was (fairly) elegant - although it would have been better if they had gone for a proper case statement, rather than switch, which is really a disguised goto. The design is such that it is was (is) easier to implement, especially on the smaller systems we had 20 to 30 years ago.

Probably better to say that a C compiler was a more cost-effective choice.

Another thing to bear in mind is that, at the time, the Basics available were mostly interpreters (hence slower), and mostly GWBasic with various proprietary tweaks (hence not portable). It's generally considered unwise to release an interpreter-base application in a large business environment - too prone to damage by saboteurs of idiots.
marcov
Posts: 2938
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Postby marcov » Aug 17, 2008 16:15

arenth wrote:@marcov You are argueing a completely semantic point simply to fight an arguement that really isn't there. Yes when I say C I mean gcc, and thats because 90%(exaggeration and in no way represents a real number) of the world that still uses C uses gcc.


(actually I'd put my money on the bulk of them compiling their C code using a C++ compiler like MSVC or BCB)

ure there is a tiny collection of C interpreters, and sure they are slow however, when it ultimately comes down to it, when people are comparing C to FB, it is in fact gcc to FB.


Which I'm not disputing that they mean that. But that doesn't mean that you should let them get away with such inaccuracies.

You still of course missed the whole point of my original post. Which is that people tend to look at a few domain specific, somewhat arbitrary points when comparing language (a) with language (b).


And again you miss the point that comparing implementations and languages are totally different things.

In this case I chose to compare the speed of one vastly majority implementation of C, vs the only implementation of FB. Now we are having a pointless arguement about some pointless semantic.


Then stop telling you are comparing languages, because you can't. You can call that pointless semantics, but it is a rather big difference. Otherwise you might just as well compare Commodore basic to GCC.
arenth
Posts: 511
Joined: Aug 30, 2005 6:22

Postby arenth » Aug 18, 2008 1:44

Bah. The point was never my personal comparisons, I don't care that the most common freely available implementation of C is faster than FB, I still use FB. The point was that most people who do in fact worry about such comparisons are usually ill informed, and that essentially it was a domain specific comparison in the first place.

The point being an answer to the question why people say C or CPP is better then BASIC, I chose to compare gcc, because of its widespread use, and FB because this is the board we are on.

As a somewhat irrelevant side note, I'd wager most people do in fact use GCC vs msvc/BCB, if google fights is any indication (not something I'd put money on) GCC returns 29,500,000 results, msvc 1,340,000 results, and BCB 12,700,000 results.

But again this whole thing seems pointless, so instead of creating an arbitrary list as demonstration of why people say C/CPP is better then gcc, I'll just say its because they are ill informed, closed minded, and unenlightened to the joys of FB.
JaDogg
Posts: 345
Joined: Apr 13, 2008 12:11
Location: Sri Lanka - Negombo
Contact:

Postby JaDogg » Aug 26, 2008 5:26

hello , who vote for Freebasic than gcc
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Postby notthecheatr » Aug 26, 2008 17:41

I think FreeBASIC has potential to be better than C, simply because the syntax is cleaner and easier to learn/use. In fact, I already prefer FreeBASIC to C, and when FreeBASIC has full OOP I think I will rather prefer it to C++ also.

That said, I would never place the original BASIC over C++ or even C. BASIC has a bad name because of its bad beginning. I think the modern FreeBASIC is nice, and thus C is only more popular because before FreeBASIC the language BASIC sucked. The older BASIC sucked, and although more modern variants (QBASIC and Visual Basic, for example) are a great deal better, they still have many problems. Many of the problems C++ was designed to address still exist in those languages (although lately VB is getting better I think), and even C is better in some ways.

With FreeBASIC, we finally get to see that BASIC can be structured, procedural, even OO, and generally is capable of being a good clean decent language. In other words, we finally see that it's possible to be a serious programmer and use BASIC. But C and C++ are still more popular, for the variety of reasons mentioned earlier (more efficient, more developed with more features, and they've been serious languages for a lot longer - they have a bigger user base and more developers). Even once FreeBASIC is at that point, I suspect it will remain a niche because of the following reasons:
-More people know C/C++. The majority of programmers know and use these languages. FreeBASIC is a minority.
-More code is written in these languages. People wouldn't want to learn a new language and try to convert all their old code into it - especially if it is functionally equivalent to the other language, and doesn't really add anything new or more useful. And since most commercial programming ventures likely use existing code in those languages, people working for them will likely continue to use C/C++ too.

So what hope does FreeBASIC have? Well, I think the best hope is to help new programmers. Because of its simpler and (imho) more elegant syntax, it's easier to learn and use. So new programmers who would like to learn programming as a hobby may begin to use it, and stay with it (particularly once there are the important features - gcc emitter, OOP, etc.). Once people see FreeBASIC as a serious language, they may begin to use it. And eventually, as new companies are started and whatnot, people will be able to use it because it no longer has to compete with massive amounts of existing code written in other languages. In a new company, FreeBASIC can easily replace any other language because they have no skeletons in the closet to deal with.

I think FreeBASICs greatness is still a ways in the future, but until then, we can all help by continuing to use FreeBASIC and becoming more proficient users so we can help test for bugs and experiment with new features, and possibly eventually be able to work on the compiler. With more developers, the project can grow faster, and the more of these "dream features" are implemented the greater the compiler and language will become. As that happens, the community will grow quickly as well.
JaDogg
Posts: 345
Joined: Apr 13, 2008 12:11
Location: Sri Lanka - Negombo
Contact:

Postby JaDogg » Aug 31, 2008 5:37

Help

Who wrote the first basic interpreter(is is BillGates???)
jevans4949
Posts: 1151
Joined: May 08, 2006 21:58
Location: Crewe, England

Postby jevans4949 » Aug 31, 2008 14:38

Kemeny & Kurtz, in 1964, whe Billy was 9 years old.

Return to “Beginners”

Who is online

Users browsing this forum: Google [Bot] and 4 guests