Click to See Complete Forum and Search --> : What makes C and C++ what they are?
ericmuttta
Aug 20th, 2001, 10:57 AM
Hi everyone, if you dont mind I would like us to have a long discussion about the 2 programming languages C and C++. Why am i saying this on a VB site, well I am a VB user and I have been learning C++. There is a great difference in the two languages and I wanna know all there is about why C++ is just a good as everyone says it is.WARNING I AM NOT A C++ EXPERT SO I MAY MAKE MISTAKES HERE BE EASY.
To be honest I am against C++ for ONE thing: the syntax. Some of you may have seen the obfuscated C code competition somewhere on the net (www.ioccc.org). The things you can write with this language, God have mercy. Here is a short clip of some C code ( dont ask me what it does, I dunno and dont wanna know)
[x] );
} p(H,
H,r );
F; x;
) { E S=
e ; w l =
" !{ ,;lf6D@"
; j X 1-g; F; *++l;
){ *S++ =*j; j X*l%3*g-
g+*l%5*b-3*b; } y =M x-G);
y =M-J)* M-x)+ M-J-1)*y+.01; y=
sqrt((u+q[--x]+.1)/y ); o-=T; C i)+
#define Z(x)(t(0,(x-C)/y)-l+1e-6*(x-Q))
.5; K=M-B); { N f=I,Q=0; F; f-Q>c; ){ P l=0
; N H = C+c/2+1; H%=c; H X(f+Q+c-2*H)/2/c*c; l=
Z(Q); O=(A-W)*Z(H)/Z(f); _(O,R=B?K>= H:L/k>O+W); *(
R?&Q:&f)=H; } Q X f; *S=*j=Q/=2; s=B?s:Q+k; f=Q+n[x/z];
n[x/z]=x%z+J%(z*2/g)?f:!putc(x?l[4*g*f/z/z/I-8]:10,stderr);
H-=U; F O=156; O--; ){ H--; *H=e[O%U]*e[O/U]/y+.8**H; } C-=Q+.5
; y i/.9)-Q-C; p(p(r+T,r,r),H,r); h[x]=.7*h[x]+C*C; u X h[x]; u*=.7
; d X C>0?-y:y; } } j X 9; } _(_(x,x),x); } D 0; }
Now I know that people never write programs like that but I have seen some well formatted code thats not as attractive as it could be. Somebody one day just count how many operators you have in your C/C++ code in you'll see what I mean.
Then there are the little oddities such as the blasted semi-colon.
Compilers know when you have left it out and even know where it should have gone. Now somebody correct me if I am wrong, cant the compiler add it for you (in most cases). i can see what advantages the compiler has coz of it but in some cases I dont know why its needed. Somebody tell me whats wrong with this code:
class SomeUseLessThing
{
public:
int a;
void fn1(int b);
private;
int c;}
Forgive me if I am wrong but on one of those days, if you looked at the above code without the compiler there it would look fine. Even as you code it and finish things look pretty okay, try and compile then BAM!!!! "private;" should be "private:" and that the last brace should have a ; following it so the line would be "int c;};"
Following on, is the bracket. Its very much easier to type when compared to words in other languages such as Pascal's begin and end or VB's: Function BlahBlah()....End Function. But however its much harder to spot and pair up, especially when there loads:
int Function(int a, int b){//i hate this bracket's position
{/*block1*/ int c=23;{
/*block2*/ int e=12;} int f=12} int g=23}
These are some of the things, and give a beginner one or two of those for a couple of hours and boy are they in for a long night.
Now DONT BE MISTAKEN I KNOW THERE ARE GOOD THINGS ABOUT THIS LANGUAGE AS WELL.
I have evaluated it on other counts and it measures up. For instance the speed thing, I am a performance super freak so when it comes to writing super fast speed bombs, naturally C++ would be the pick. Only thing is, C++ isnt exactly a toy language. Learning the ins and outs of the beast will take long and I know the journey WILL NOT BE EASY.
Oh they are about to close the library just now, so thats it for now. Please give me your feelings on this language, share your experiences, likes and dislikes and we'll pickup again on it later.
Ps: wanna know why I want all these ideas and opinions? I want to create a better C++, a more readable but by all means just as powerful language. I have been working on it now for 3 months or so. What do you get when you cross breed C++ and VB well the answer is not a.(java) or b.(c#) its c.(Ciyana). Thats the code name of the language while its under development. Anyone interested please contact me( ericmuttta@email.com). Here is an excerpt for hello world.
Public Function Main()
Reserve String StorageFor Msg = "Hello World"
Console.Write (Join(Msg, "From Ciyana"))
// the output is : Hello World From Ciyana
End Function
CiberTHuG
Aug 20th, 2001, 12:43 PM
Okay, you are going to write a new language, yet you are just learning C? I don't think that is such a good idea.
C/C++ is not the world's best language. It is a bit old and has some problems, but it is much better than VB. Before I go into why, let me tell you that the introduction of Java and C# has prompted the upgrade of C/C++. The new language, which is being tenatively refferred to as D, will be out in a year or so.
Okay, the people who wrote the language, weren't trying to make it human readable. That wasn't their goal. They weren't going for a nice cuddly language. If you don't like that, then too damned bad. The new language won't be cuddly either. There are cuddly languages out there, and that is a good project, but it wasn't why we have C/C++.
I like the syntax because int myInt; is shorter than Dim myInt as Integer. Also, we have ++, --, %, +=, -=, for structures that have much more flexiblity, classes, ==, [b]scoping[b], malloc, AND POINTERS.
In C++ (and my favorite language Perl) you can do things like...
for(t = 0, x = 0, y = 0; y < 100; ) { x = t++ * 2; y+=x;}
Now, I can't think of a time when I need to do that, but it is legit. The semicolons let me put more than one statement on a line, and the braces let me put the block any damned where I please. :)
To do that in VB...
t = 0
x = 0
for y = 0 to 100 - 1 Step 0
x = t * 2
t = t + 1
y = y + x
next
'Course, syntax doesn't make a language. VB has serious problems with scoping, memory allocation, and pionters.
Anyway, if you want to have much fun, learn Perl when you are done with C.
PS, your code sample...
Public Function Main()
Reserve String StorageFor Msg = "Hello World"
Console.Write (Join(Msg, "From Ciyana"))
// the output is : Hello World From Ciyana
End Function
The output should be "Hello WorldFrom Ciyana". I don't want to learn how to remove spaces that a join function adds. :)
Wynd
Aug 20th, 2001, 12:57 PM
The semicolon thing: The compiler doesn't know exactly where it goes, it just guesses. If it did know, you wouldn't have to put it in, the compiler would just add them in for you.
Brackets: Just format your code nicely. It's not that hard.
int function()
{
for (int i = 0; i <= 10; i++)
{
if (someVar == otherVar)
{
cout<<"equal"<<endl;
anotherVar++;
}
}
return anotherVar;
}
If you are going to write another C++, I would stick to the C++ brackets as they are easier to type than VB's keywords. Something like this maybe:
Public Function Main()
{
Reserve String StorageFor Msg = "Hello World "
Console.Write (Join(Msg, "From Ciyana"))
// the output is : Hello World From Ciyana
}
kedaman
Aug 20th, 2001, 01:12 PM
VB doesn't have any "pointers", they are all hided in the variables so that the user won't go do any stupid mistakes which you pretty easily can do in C++. Using Copymemory and a string or array in a UDT structure you can though simulate pointers but it's pretty awkward, nothing to recommend except in special cases.
the semicolons deliminates each statement, not the linefeeds or colons like in vb. Vb colons won't deliminate all statements either.
Whitespaces and linefeeds are ignored in C++, which means you just put them to tide up your code.
If you are interested in speed, C++ let's you do a lot of lowlevel operations, pointeraritmetics and even inline ASM. Inlining methods makes your code run faster as functions are not called and so the stackprocessing parts are skipped, instead their contents are expanded, that is copied into the position where they are called. C++ classes are structures, that is equivalent with UDT types in VB, so access to them is tons faster and they don't take up any extra space like COM objects do.
kedaman
Aug 20th, 2001, 01:31 PM
Brackets are not for tidying up code, Brackets are used for enclosing
1. namespaces
2. class contents
3. function contents
4. if and else, switch, for contents
5. locally used variables
there's probably something else i'm missing but these are most general.
filburt1
Aug 20th, 2001, 01:32 PM
Brackets can make blocks of code easier to separate from other code.
chrisjk
Aug 20th, 2001, 01:35 PM
Originally posted by CiberTHuG
In C++ (and my favorite language Perl)Perl rules!
kedaman
Aug 20th, 2001, 01:35 PM
Those brackets actually make the variables inside them local
spetnik
Aug 20th, 2001, 01:35 PM
I hate to hear people talk about C/C++ in a bad way. These are two very powerful programming languages. Although VB is a very nice frontend for business applications, very few retail apps are written using VB. C and C++ give the developer fast, powerful operation on a user's machine. They have amazing graphics capabilities, as well as the ability to do alot of low-level programming. Pointers are extremely useful in C/C++, and I sometimes have to write many lines of extra VB code, when in C I would just use a pointer.
The Difference between C anc C++ is that C++ is an object-oriented programming language, while C is not. I am pretty proficient in C, although my C++ is limited.
I, personally, have seen many programmers try learning VB as their first language, and it is horible. They sometimes can do a job here or there, but they do not really understand what they are doing. By learning C first, you get an idea of what a programming language is all about. You understand what can and cannot be done from a software level, and also understand what is going on in your VB app.
I tried learning VB before C. I was not bad and wrote a few programs. After learning C, I realized that my previous skill sucked. By learning C, my VB skills became immediately more proficient. I learned how to use VB to get the most power out of it. I also learned that VB is best used for Database-driven business and web applications. When it comes down to making retail applications such as productivity tools, net apps, or games, VB just can't seem to cut it most of the time. When you have to start using numerous APIs, you must think about using C++ instead. VB wasn't intended to be used primarily with APIs. Yes, they are available, and Microsoft Documentation tells u to use them sometimes, but that is not the purpose of VB. The APIs are there to allow you to use a few Windows features in VB that you may want to use, even though VB does not support them. But when u look through most of the software that is out there (multimedia, filesharing, games...) you will see they are mostly made in C++ (along with some in JAVA). There is a reason for this. Shawn Fanning (of Napster) could have used VB. He may have even used it to create some DLLs for all I know. But C++'s libraries make it much easier to do the job.
The bottom line is, VB is not a bad language. It simplifies many tasks that would take longer if done in C. But when you start trying to create massive multimedia apps or games or the like, productivity will lag. Additionally, if you do not know a lower-level language like C or C++ (or ASM, JAVA...), you will run into many problems with your apps and/or write horrible, backwards, slow code to do simple things.
So my suggestion: Before you learn VB, learn C (or C++, but C is simpler. If you want to learn OOP, then C++ or JAVA is good). You will realize in the long run that it will help you no matter what you program in. Try it. Not because I do it, but because you might find it useful.
Of course, that's just my opinion, I could be wrong ;).
spetnik
Aug 20th, 2001, 01:36 PM
o, and btw, they're braces, not brackets :)
kedaman
Aug 20th, 2001, 01:59 PM
I've always known them as brackets somehow :confused: well :)
My worst mistake was learning Gwbasic as my first language, i had a look at some of my apps made in it (thats about 8 years ago) and they just makes you sick, I'll post something and you'll see
filburt1
Aug 20th, 2001, 02:00 PM
Originally posted by chrisjk
Perl rules!
No interpreted language can rule.
filburt1
Aug 20th, 2001, 02:01 PM
[] Brackets
() Parenthesis
{} Braces
chrisjk
Aug 20th, 2001, 02:43 PM
Originally posted by filburt1
No interpreted language can rule. Yes it can, and it does.
chrisjk
Aug 20th, 2001, 02:44 PM
Originally posted by filburt1
[] Brackets
() Parenthesis
{} Braces Or just to make it confusing...
[] Square brackets
() Brackets
{} Braces
CiberTHuG
Aug 20th, 2001, 02:49 PM
Originally posted by filburt1
No interpreted language can rule.
It can. It does. And you can compile to a stand alone executable if you really want to.
ericmuttta
Aug 20th, 2001, 03:30 PM
Wow thanks for the quick responses people. Okay now how do I respond to all comments made. I know will take it in the order that the replies came.
Alright CyberTHug, A long while ago I grabbed a Microsoft C book and learnt quite a lot of theoretical C. I never intended to write any code, I just wanted to be able to understand all the applications I see coz most of them are written in C/C++.
I realise Dennis Ritchie and Ken Thompson guys were people who wrote operating systems and were hardcore programmers. They were working on PDP's , I think it was a PDP 7 then an 11 I dont quite remember. I know why C is so cudly. On the PDP's they didnt have the sort of memory we have today, our juicy 128 MB super dupa RAM. They couldnt afford to have lots and lots of lines of code coz memory was scarce, hence things like "int myInt" and not "Dim myInt as Integer". But what I now realise is we have chunks of memory to play with. Okay I am a performance freak and wont fool around with resources but it does mean that todays languages can handle the extra words that make the code readable. How about this. Out of all the words in the Ciyana declaration below you only have to type the name:
Reserve Integer StorageFor myInt
How? simple since these days everything nearly runs in an IDE we can have dialogs which you fill in. In the above case you select the data type and type the name then the rest is added for you. Now this may use more resources I admit but it could be feasible. VB and VC++ actually have Intellisense right? you type some it types the rest. Whats your view? Do you find it easier to type it all or do you prefer the autocomplete? I know some people can type like madmen/women (cant be sexist now can we)
but you gotta think about things like strain injury and the likes. You see I want to address such issues as well. For example in Ciyana i intended to use [] instead of () for my routines and arrays. So the snippet I gave before should have been: (note I didnt specify the return type b4 oops!!)
Public Integer Function[]
// blah blah
End Function
Why on earth am I doing that? Notice typing [] requires no shift while () actually do. When typing these I have to hold the shift key with my small finger and stretch up to the numbers (pretty tiresome if you are coding the whole day). Everyone what do you think of this? Good idea or is there some hidden fact about the ()?
By the way those operators ++, -- etc are actually in VB.NET......FINALLY. I agree with you they are pretty cool and Ciyana definitely will have them.
Hey guys what do you think about the == and =. Should Ciyana have them that way where the equality operator and assignment operator are different or should I take the VB approach and just use = for both?
Now Cyberthug, whats [b]scoping[b] I've never seen that before help me out here.
Okay now malloc and pointers. Oh by the way Ciyana is actually a language for sysytems programming so this sorta thing will be there for sure. Here is how malloc is implemented in Ciyana:
Get Byte[ byte count] StorageFor MyPointer.
I wanted the variable declarations and pointer declarations to be similar except for the Reserve (done at compile time ) and the Get (done at runtime) words. Releasing memory is just giving back memory to the OS which is what you are doing when you use delete[] myPointer in C++ (the square bracket thing some book said its always a good idea to include them so destructors for objects are called or something like that). Ciyana does it as follows. Since you Get memory and use it, when you are done you:
GiveBack StorageFor myPointer // where GiveBack is a keyword
I havent figured out a clean way to dereference them yet and I am still thinking whether C/C++'s method is cool, any ideas ?
Next, the :
for(t = 0, x = 0, y = 0; y < 100; ) { x = t++ * 2; y+=x;}
When compared to VB this structure is shining bright in terms of being to the point. Question for those of you who have had to maintain C/c++ programs. How do you fare with such conciseness when its been months after you wrote the code or are maintaining someone else's code ( the worst nightmare at times)?
VB is somewhat long winded but a possible though longer equivalent is:
t=0 : x = 0
for y = 0 to 99
x= t * 2 : t = t + 1 : y = y + x
' in VB.NET we will have ability to do this:
x = t * 2: t++ : y+=x
next
That cool for loop structure, I am thinking of modifying it slighltly for Ciyana purposes so I will get back to you when I do.
Now another thing I dont understand. When code is compiled be it written in C, Perl , Java or even Ciyana( when it comes out), it all ends up in some form of machine language (for compiled languages ) or some other intermediate form (for things like Perl).
So why on earth has VB got memory problems etc when ultimately, it ends up looking just like a C application when in binary. Is it the compiler or the language that has the problem? And if its the language, how can lines of text cause memory problems? Someone educate me here, theres something I am missing here. And since I want Ciyana to perform well, what am I meant to do to avoid those scoping problems n all?
Hey CyberThug, well spotted for the Join function. BUT ONE THING IS FOR SURE OBJECTIVE ONE OF CIYANA IS FULFILLED. ITS EASY TO UNDERSTAND, NOBODY EXPLAINED IT AND YOU GUYS PICKED IT ALL UP. Ofcourse thats just hello world but the rest is even better.
OOPS I GOTTA GO THEY ARE CLOSING DOWN AGAIN ( I AM AT WORK THIS TIME) I'll be back again on Tuesday. Thanks people and please lets keep talking. See ya, Eric.
Jim Brown
Aug 21st, 2001, 04:58 AM
Originally posted by chrisjk
Or just to make it confusing...
[] Square brackets
() Brackets
{} Braces
Or how about.....
[] square brackets
() round brackets
{} curly brackets
Jim Brown
Aug 21st, 2001, 05:06 AM
Oh BTW, I hate to admit it, but the debate about the names of these things ({[ ]}) was the only part of this thread I understood!
kedaman
Aug 21st, 2001, 05:39 AM
Originally posted by ericmuttta
[B]
Public Integer Function[]
// blah blah
End Function
Why on earth am I doing that? Notice typing [] requires no shift while () actually do. When typing these I have to hold the shift key with my small finger and stretch up to the numbers (pretty tiresome if you are coding the whole day). Everyone what do you think of this? Good idea or is there some hidden fact about the ()?
I have to press alt gr to access my []'s. I don't care about the parentesis and brackets, my fingers are used to all combinations on the keyboard so they never complain. I never think about where my keys are, there's probably a part of my brain that does that automatically.
By the way those operators ++, -- etc are actually in VB.NET......FINALLY. I agree with you they are pretty cool and Ciyana definitely will have them.
Hey guys what do you think about the == and =. Should Ciyana have them that way where the equality operator and assignment operator are different or should I take the VB approach and just use = for both?
I don't use C++ or any other language for that sake, I haven't seen everything in VB.NET but I think VB's original nature makes ++ and -- pre and postfix operators pretty useless. There's a wide range of statements but does that beat C++ that has only one and perfect type of statement? No way.
Now Cyberthug, whats [b]scoping[b] I've never seen that before help me out here.
Go learn C++ fully, with everything that comes with OOP, take a look at templates at the end and you'll be convinced (that is if you understand what you can do with C++) that there's no need for a Ciyana.
CiberTHuG
Aug 21st, 2001, 08:33 AM
Okay, a couple of points:
Don't worry about the keyboard. Some of use don't want to use QWERTY boards anyway.
Don't worry about the IDE. Any language that was written to work well in an IDE is crap. The language should have it's own merits. The IDE is just icing. Besides, I don't like using VS.
Scoping: Here are two blocks of code
VBScript
if (myTest) then
dim myVar
myVar = "Hello, World."
end if
myOutput myVar
PerlScript
my $Var;
if (myTest) {
$Var = "Hello, World."
}
myOutput($Var);
Notice how I declared myVar inside the if block in VBScript. If I had done the same thing in PerlScript and declared $Var inside the if block, then I would not be able to access it later outside of that block.
Scoping is the set of rules that affect the lifespan and visibility of a variable. In VB if you give a variable Global scope, then it can be seen everywhere (and you have just broken the second law of good programming).
VB's scoping is poor. I should be able to declare local variables inside a block and use them in that block and not have to worry about a conflict outside of that block. That is the way I preffer. VB doesn't seem to set any scoping smaller than a function/sub.
Also, it is Ciber (http://www.ciber.com) with an I.
nabeels786
Aug 21st, 2001, 09:50 AM
i just finished learning pointers in C++...but
whats the point of pointer?
why point to the memory address of a variable when you can do
var1 = var2;
instead of
int *var1;
int *var2 = new int;
*var2 = 3;
*var1 = &var2;
(i think thats how you do it..im prolly wrong..correct me)
---
also in vb, i think instead of "dim"ing within a sub, if you do "private", that var will only be within that sub..im not too sure hto..
spetnik
Aug 21st, 2001, 09:57 AM
Pointers are very useful for manipulating strings and arrays. Also, what if a function needs to directly modify a value? C/C++ allow you to refer to the value of a pointer variable wth an asterisk and the address of a variable with an ampersand.
Additionally, C allows nested pointers, where **p would be a pointer to a pointer. This way, you can manipulate multi-dimentional arrays in the most powerful way.
In my opinion, anyone who has not learned how to use pointers, is limited in his programming potentials no matter what language he uses
Of course, that's just my opinion, I could be wrong.
CiberTHuG
Aug 21st, 2001, 10:05 AM
There are two reasons (that I can think of off the top of my head):
Number 1: And I don't use this very often if at all.
If you set myPtr to myVar, then if the value of myVar ever changes, the value retreived by myPtr will have changed. That way you don't have to keep reassigning variables. And the pointer will point to that memory, even when the variable for whom that memory has been reserved has gone out of scope.
Number 2: Lists
The simpliest is:
struct {
myInt;
myPrev;
myNext;
}
I can make a double linked list with pointers. I can then splice and join like an array, but I can make that struct as big as I want. I can start to make binary search trees, and it goes on from there.
Right now I'm using this in a PerlScript ASP:
$RS = $dbConn->Execute("$SQL");
while ($RS && !$RS->{EOF}) {
$deparmentID = $RS->Fields(0)->{Value};
$departments{$deparmentID} = [];
$departments{$deparmentID}->[0] = new TALLY;
$departments{$deparmentID}->[0]->{Name} = $RS->Fields(1)->{Value};
$RS->MoveNext();
}
$departments{} is a hash (%departments), or associative array. It has key/value pairs. The keys in this case are department IDs. The values are anonymous arrays. I'm pointing to the array. The first position in the array (index 0) is pointing, in turn, to a struct called TALLY, which has a scalar variable called Name.
Mind you I don't like that set up to terribly much, but it was quick and works. To do that without pointers requires huge freakin multideminsional arrays that have to be ReDim'ed and Preserved every time I want to add a new department.
CiberTHuG
Aug 21st, 2001, 10:07 AM
Originally posted by spetnik
In my opinion, anyone who has not learned how to use pointers, is limited in his programming potentials no matter what language he uses
Amen.
filburt1
Aug 21st, 2001, 10:08 AM
Pointers calls general protection faults and security violations. That's why they're not explicitly implemented in Java. In Java, practically everything is a pointer, but you don't declare them that way and you have no way of knowing where in memory the pointer refers to.
denniswrenn
Aug 21st, 2001, 10:10 AM
If you use them correctly pointers will not "call general protection faults and security violations".
CiberTHuG
Aug 21st, 2001, 10:19 AM
Exactly Dennis. They are called memory leaks, too, Fil.
Java uses pointers for everything because it is meant to be implemented on various platforms. Those platforms will have very different mechanisms that Java is trying to hide from you, keep transparent. You have a set uniform front end, and the Java engine has to deal with the various memory management techniques that can be implemented on different platforms.
kedaman
Aug 21st, 2001, 11:18 AM
Originally posted by CiberTHuG
Exactly Dennis. They are called memory leaks, too, Fil.
Memory leaks occurs when allocated memory on the heap is not deallocated where it should be.
The real power of pointers are pointer aritmetics, not the access they provide, as languages with hided pointers do that anyway, but instead disallows any pointeraritmetics which is mainly a big source of programming faults, but all lowlevel operations are such by nature.
CiberTHuG
Aug 21st, 2001, 11:28 AM
I was thinking memory leak as in...
If you have a memory space (say 4 bytes) reserved and you have a pointer to it. If you write 5 bytes of data to that address, you will write over top of whatever comes after. As long as the next byte is still part of the same program, the OS should let you do that. The OS should keep you from access the memory block of another program (access violation).
Perhaps leak is not the correct term, but anyway. I know it is not an overflow/underflow problem. That is floating point.
I've never used pointer arithmetic. I've never had a need to. The closest I've come is some assembly work with offsets. I'm sure its fun, though. :)
kedaman
Aug 21st, 2001, 11:43 AM
ooh :p you're missing something big ;) Pointeres are not there to look fancy, there's a reason and that's pointer artimetics. Otherways you could go switch over to Java or something less dangerous. It takes care of all memory allocation/deallocation and pointers.
I think the problem is called fence post error, but i'm not quite sure if it's generally for all kind of operations on unallocated data on the heap.
CiberTHuG
Aug 21st, 2001, 01:46 PM
VB also doesn't short circuit. I just rediscovered that. *grumble*
kedaman
Aug 21st, 2001, 02:11 PM
not to induce confusion among the simpleminded
ericmuttta
Aug 21st, 2001, 02:57 PM
Hey people I am back!!!!
Now whats going on here, everyone is talking about pointers all of a sudden. Nobody said why C++ is more efficient than say VB or any other language for that matter, when ultimately after compilation they are all binary code. So is it the language or the actual compiler that leads to the efficiency?....somebody please help me out here.
Okay about the bracket/brace/whatever thing, I'll skip that I had forgotten that keyboards vary across the world.
As for the ++ and -- operator, in VB they are only useful for stuff like: a= a +1 within loops. For Ciyana, i intended to limit them to that very purpose. In C++, I have seen pointer arithmetic, function calls etc using this eg myFn(i++) .Now thats alright but problems can arise with that sort of thing when macros show up:
Woops gotta go, we'll be back to show you what i mean with the macros.
filburt1
Aug 21st, 2001, 02:59 PM
Originally posted by ericmuttta
As for the ++ and -- operator, in VB they are only useful for stuff like: a= a +1 within loops. For Ciyana, i intended to limit them to that very purpose. In C++, I have seen pointer arithmetic, function calls etc using this eg myFn(i++) .Now thats alright but problems can arise with that sort of thing when macros show up:
Are you kidding? I use ++ and -- all the time and wish that VB.NET would have them! And you can use += in string concatenations.
And me hate pointers. :mad: :)
parksie
Aug 21st, 2001, 03:05 PM
Macros are evil, use inline functions instead :) Same effect and the code is no slower, but it's safer :)
filburt1
Aug 21st, 2001, 03:08 PM
This is my favorite macro definition set:
#define bool int
#define true 1
#define false 0
No more including bool.h for older C++ libraries! :)
chrisjk
Aug 21st, 2001, 03:09 PM
EVIL macros!
filburt1
Aug 21st, 2001, 03:09 PM
And this:
#pragma message Your code is evil and bad
That makes the compilter give you an error or warning that says "Your code is evil and bad" :D
CiberTHuG
Aug 21st, 2001, 03:12 PM
Pointers are good.
Okay, why is C++ more efficent than VB.
Okay... memory use. VB uses more memory than C++. If you ask for a String in VB, you are sucking up memory. In C++ I can char* and get just what I need.
I would say write a simple algorithm in both VC++ and VB, and then disassemble them. Look at them. We can suggest code to use if you would like. Perhaps the Towers of Hanoi. But I think you will see streamlining in the VC++ executable that you won't see in the VB.
parksie
Aug 21st, 2001, 03:13 PM
Originally posted by filburt1
This is my favorite macro definition set:
#define bool int
#define true 1
#define false 0
No more including bool.h for older C++ libraries! :) That should be typedef int bool; or whatever way round it goes :p
And just get a new compiler if it doesn't support bool :D
kedaman
Aug 21st, 2001, 03:17 PM
That's actually a very complicated qwestion to answer. With current available compilers C++ is leading, but as a matter of fact the language forms the programmer as well as the programmer forms the code, so C++ has it's unique advantages. The very statements provide much more flexibility, in vb you either use the integrated calls ones or do simple lefthanded assignment. C++ is partly lowlevel partly OOP language, and besides all that there's templates (ooh, I love those) so while having the ability to maintain extreemly reusable (and I mean Vb or even Java has nothing comparable) interfaces the language supports detailed refinements and optimizations, if that's not enough, the compilers supports inline asembly as well. The operators and methods in C++ all return values, including unary operators, almost all operators can be overloaded and used for user specific purposes with user specific types, the statements are mainly operator/function tree's which evaluate and assigns as the the operators/functions executes, that provides the flexibility that C++ is so popular for. Although most C++ users have a RAD instinct, C++ really most powerful when used for OOP, those who've realized that power must know why, and there's probably no other way to understand it but learn it by yourself.
kedaman
Aug 21st, 2001, 03:21 PM
typedef's are aliases, not macros ;) and macro's aren't evil if they are used correct, M$ inlining can't be trusted
parksie
Aug 21st, 2001, 03:23 PM
I know they're aliases :p
I never trust anything, although occasionally it gets something right (I checked the listing on a few things but never worked out just WHY it wouldn't inline certain things).
kedaman
Aug 21st, 2001, 03:23 PM
vb strings suck up 10 bytes + 2 bytes per character
the later since Vb default strings are unicode
byte strings suck up 22 bytes + 1 byte per character, but I don't see many vb users actually use them
kedaman
Aug 21st, 2001, 03:25 PM
did you use the 3 pragmas? I haven't tried on looking at listings, i think i need a hexeditor that disassebles but I haven't had time to get one
parksie
Aug 21st, 2001, 03:26 PM
I think WinHex does disassembly - haven't tried it out yet.
I played with the pragmas but didn't have the time or the inclination at that moment.
kedaman
Aug 21st, 2001, 03:28 PM
WinHex, I'll check it out some time
CiberTHuG
Aug 22nd, 2001, 01:52 PM
In addition to pointers, structs, unions, and classes, your new language should support hashes and anonymous variables.
Oh, wait, that's Perl. :) Guess we don't need a new language. ;)
I'm complaining because I'm using VBScript in ASPs (at the client's request, not mine) and the only data structure I can use is MULTI-DEMENSIONAL ARRAYS!!! That sucks so much.
kedaman
Aug 22nd, 2001, 01:57 PM
It can't get worse than that :p
ericmuttta
Aug 23rd, 2001, 02:58 PM
Hey CiberThug, hashes and the other stuff I know, but what are anonymous variables. By the way, I havent given you the full specification for Ciyana yet, thats why you underestimate it.There are things in Ciyana that no other programming language has. I am on research for now but soon, things will get hot. i am sure Perl is cool but you wait......gotta go.
CiberTHuG
Aug 23rd, 2001, 03:49 PM
They are just that, variables that you don't know the name of. But how do you reffer to them? Well, somone knows their name. :)
Here is a bit of Perl code to demonstrate.
// We are going to raid a DB and get a list of resources
// and their UIDs. Then we are going to build an array of their
// response times.
my %Resources;
my $RS = FuncToReturnRecordSet(myDB);
foreach my $record ($RS) {
// We will step through each record in the record set and
// put the UIDs and Resource Names in a hash
$Resources{$record->{UID}} = $record->{Name};
// This creates a UID/Resource Name key/value pair.
}
foreach my $currUID (keys(%Resources)) {
// We are now going to step through our list of IDs in our
// hash and do a DB look up. Now we could just use pointers,
// but we are going to create an anonymous array of the values
$RS = FuncToReturnRecordSet(myDB, $currUID);
my @$Records{$currUID};
foreach $record ($RS) {
push(@$Records{$currUID}, $record);
}
}
Now that is very simple code, and I've left out a lot. Let's say you have a Resource with the name MyResource and an ID of 001. There will be a key/value pair in the hash of 001/MyResource. And now there will be an array with the variable name MyResource that contains all of the response times for MyResource.
The variable's name is "@MyResource", but you don't explicitly know that when you write the code. Everytime you call that variable, you call another one which gives you that one's name.
So if I want to find the second response time fo MyResource I would ask "$MyResource[1]". 'Course, in the code, something had to trigger that, and whatever triggered that will hopefully supply resource name (in say a $ResourceName variable) or the UID (again in a $UID variable).
Now I ask for "$$ResourceName[1]" or "$$Resources{$UID}[1]".
Again, you can use pointers to accomplish this. In Perl "->" is the dereference operator for pointers. You see where I have "$$". That is analogous to dereferencing my anonymous variables.
'Course, I've been working in VB/VBScript for the last six months, so my Perl may be rusty. But hopefully you get the idea.
You hopefully don't need to know Perl to understand what I've just done.
parksie
Aug 23rd, 2001, 03:57 PM
Oh I see what you mean. A bit like PHP? Probably nicked from Perl ;)$n = "myvar";
$myvar = 5;
$$n = 10;
# $myvar is now 10That sort of thing?
CiberTHuG
Aug 23rd, 2001, 04:12 PM
Exactly Parksie.
A lot of PHP is nicked from Perl.
parksie
Aug 23rd, 2001, 04:17 PM
And I can see why, they're bloody useful some of those things :) Plus it makes it dead easy for Perl programmers to use.
Jay Rogozinsky
Aug 23rd, 2001, 06:25 PM
When I started in computers I didn't have C, I didn't even have assembly. I started with machine code. Wow - those were the days. Wiring your own cpu's. Lot's of fun.
When considering languages you always end up with the big dilemma ... you want a language that is low-level to be fast, but it should be built to be portable. These two things force you to compromise.
Some platforms use segmented memory, some use linear, and some even use banking. This can make pointer arithmetic a non-issue. Perhaps there is some merit to dereferencing variables after all! However, this is a huge topic.
ericmuttta asked if it's the language or the compiler that make efficiency. My first answer is, the compiler. However, the language itself may contain aspects that make it difficult to be efficient. So both play a role in the potential of efficient binary code.
(By the way, all you people who say C is the most powerful and there is no need for readability. I propose you write in Machine. After all, it is the MOST powerful and the least readable (some say). The point here is that blasting VB because of it's readability is not logical. It is possible to have a readible language that is every bit as powerful as C - although, that is NOT VB.)
So why should we care about readability? Well, it sure makes troubleshooting easier. If I were to write in shorthand, my mistakes would not be so obvious - after all, one mistaken letter changes the entire word it's meant to encode. On the other hand, a long word is in context with the other letters around it, and, therefore, it is easier to catch something out of place.
.....
I could always develop MUCH quicker than those using C. Don't get me wrong, I love C. C is power and efficiency.
I have read people say VB sucks. LOL. This is not true. VB is quite useful. However, it's just like a road trip. I love nice fast looking sports cars as much as the next guy, but, you would rather take a 4x4 into the mountains. This is my point. Each has it's own use. If your gonna write a device driver or an OS, you pretty much MUST write it in C.
VB can produce programs quickly. I have written many market programs in VB. However, I have found that only-VB programmers (because they started here and do not really understand the machine) cannot write powerful VB programs (this is an important statement).
I HAVE been able to write powerful VB programs. (Even in Basic days, I was doing stuff that others could not. However, note, that I did have to write my own assembly library. Some things in Basic were just too slow.) Even in C do we not sometimes put inline assembly in?
As some have said here, and I agree, getting 'low' in the frame of things gives you an better understanding of the machine - C is closer than VB, no doubt. I think learning assembly would be wise for every programmer to start with. I also think playing with the electronics is very empowering too. For, no matter what language I have used in my life (even some mainframe ones) - understanding the machine reduces your learning curve A LOT.
Someone here said that before you embark on a new language, you should learn C. I strongly agree. I have also heard a lot of people wanting to write an OS. They too should study other OS's to know what the long-term issues are. DDE, OLE, COM, DCOM, Automation ... they all came about because of need. This need would also exist in any new OS. Perhaps with a different implementation, but still the need.
.....
This next comment is to make us think. What is more efficient?
So, lets all ask ourselves a question. We go to make a new language. We want strings, of course. How would you choose to implement the string philosophy?
In Basic, strings have a length and may contain binary 0. So, if I am manipulating large sets of strings, obtaining the lengths IS EFFICIENT.
In C, strings do not contain a length and may not contain a binary 0 - indeed this 0 tells you it's length. If I am manipulating large sets of strings, obtaining lengths IS NOT EFFICIENT (at least compared to Basic).
(YES, Basic is MORE EFFICIENT HERE. Don't believe me. Run the tests.)
.....
Remember that ultimately VB uses pointers just as much as C. It simply hides most of this from you. For those unaware, pointers are quite exposed and accessible in VB now.
I was interested that others were discussing platform issues here. Generally, extensibility is becoming the important thing, not low-level efficiency. Our computers are running faster and faster everyday. Perhaps we should just have a variable and let the platform-specific compiler do the dirty work. This does tend to be the direction OS's are going. COM and DCOM. In the end, perhaps, that variable might actually be on another computer altogether, thus having no local pointer to speak of.
parksie
Aug 23rd, 2001, 06:30 PM
In Basic, strings have a length and may contain binary 0. So, if I am manipulating large sets of strings, obtaining the lengths IS EFFICIENT.
In C, strings do not contain a length and may not contain a binary 0 - indeed this 0 tells you it's length. If I am manipulating large sets of strings, obtaining lengths IS NOT EFFICIENT (at least compared to Basic).
(YES, Basic is MORE EFFICIENT HERE. Don't believe me. Run the tests.)Good point, but I suppose if you wanted something like that then you could just have a struct containing a pointer and a length. Or just prepend the length - I did that a couple of times, leading to such lovely code as:printf("%s\n", ptr+4);Add a few choice functions to that and you can use binary zeros. I haven't ever really found much need for NULL in a C string, so I use it as-is.
Jay Rogozinsky
Aug 23rd, 2001, 06:51 PM
Exactly parksie. Hmmm. We even have to do 'dirty' tricks in C somethimes too.
If you were going to manipulate binary data in C, you would probably allocate a chunk of memory from the heap and use the returned pointer. The exact way I do it in VB.
I agree, strings are not really the place for byte 0 and they rarely show up there. The interesting point of discussion is the length aspect.
Good point, but I suppose if you wanted something like that then you could just have a struct containing pointer and a length.
This is what VB does. :-)
parksie
Aug 23rd, 2001, 06:55 PM
Originally posted by Jay Rogozinsky
This is what VB does. :-)Yep. Although it does it with the aid of a huge runtime DLL... ;)
I don't bash languages for the sake of it (except for Pascal because I hate it), and there are a lot of places where I wouldn't use C++. For example, databases. I'd much rather use VB and ADO than C++ (considering VC++ can't even compile the MS ADO sample projects I gave up on learning that). And Perl has its place for a lot of things (such as my VB->HTML converter).
Jay Rogozinsky
Aug 23rd, 2001, 08:05 PM
Yes, let us not forget that C also utilizes a runtime DLL.
VB has always been a great place to slap off a conversion utility or such.
parksie
Aug 23rd, 2001, 08:07 PM
Does it? I only use the runtime DLL for C when I can control the target environment - normally I make them self-contained.
Jay Rogozinsky
Aug 23rd, 2001, 08:54 PM
Msvcrt.dll contains calls such as strlen, printf, malloc, puts, etc. Msvcrt.dll has been succeeded by Msvcrt20.dll, Msvcrt40.dll, etc.
If you use those calls, you are using Msvcrtxx.dll. This dll, and likely some of the successors, will exist on ALL Windows systems. This is why you don't have to worry about them being there and your code always seems to work.
Only if you write very simple programs will no DLL calls be made. For instance, a simple variable increment in C requires NO outside calls - it can simply be an INC instruction on the processor.
Now, is it possible to have a compiler extract (some or all) of this code from the DLL and put it into a stand alone EXE? Yes. Does C let you do this - I don't know.
Even if it does, it does not negate the point. Both VB and C give you access to standard calls and those calls are not your code - they exist in a support DLL.
Does it? I only use the runtime DLL for C when I can control the target environment - normally I make them self-contained.
So your 'self-contained' program still relies on C library code - no matter if it's stripped into your EXE or not.
If you can, and do, put this code into your own EXE you are defeating the purpose of DLL's and also you are disallowing your end-users from upgrading a potentially buggy DLL call (i.e. even if they upgrade their Msvcrtxx.dll - your program will still exhibit the bug).
kedaman
Aug 24th, 2001, 12:14 AM
VB has the Dll due to the compiler, I heard of compiler that compile VB into standalone exe's so runtime's shouldn't be part of when considering languages, but part of compilers.
I use C++ not C, because C doesn't have the power of OOP. I'd say most programmers, quite close to 100% around here use RAD-style programming mainly, that's of course how a simple one purpose application could be programmed most effectively in time perspective, the available API's just need to be called in the correct order and that's that, hardly you do any real OOP work. These API makes your application dependent and unportable.
OOP work should be platform independent, and so C++ does perfectly, there's no need for strllen's or printf's but in RAD style projects. The main point with OOP applications is reusability, a base to derive other projects from, much the style you need for developing API's. Such interfaces where other programmers derive your work has to be as flexible as possible, well encapsulated to avoid unintended misuse, easy to use and not to forget with best possible performance. Of course you need to do compromises between these but with a poweful OOP language as C++ the performance losses are quite minimal. VB, C and ASM are far from useful in this style of programming.
The clients of enough powerful interfaces shouldn't consider about what language is most efficient in the first place but the usefullness, since if the base interface does all time critical jobs any language could be used to put them together into a interface for the end user.
Dillinger4
Aug 24th, 2001, 12:53 AM
Im half way reading through this post and i am having fun. But who ever said {} brackets or braces (what ever you want to call them) are mainly for scope. Not for tidying up your code.
Dillinger4
Aug 24th, 2001, 01:20 AM
Has anyone ever programed using Lisp, Python, or Ada?
And if so what are the strong points for each language. I heard Lisp is mainly used for AI. And Python for server stuff. Is that true?
HarryW
Aug 24th, 2001, 03:56 AM
I don't know LISP but it's short for 'list processing' which tells you a fair bit about what the language is good for. It's certainly used for a lot of AI stuff. Has too many parenthesis for my comfort though.
Python is a fully object oriented, platform independant scripting language, and I use it a lot. It's very flexible and easy to use and read (especially if you are familiar with C syntax), although it's not compiled to native machine code, so it can be slower than some languages. Still, it's fast enough for me and it's easily extensible with C/C++ modules if you want some more speed. It's mostly used for CGI apps at the moment, and in the scientific community.
Ada is more or less an even stricter version of Pascal (yikes!), which is great if you're writing code to run an ejector seat but pretty tedious if you're writing non-critical code. It's one of those must-be-bug-free kind of languages; the military use it quite a bit.
tumblingdown
Aug 24th, 2001, 04:11 AM
"Operator Overloading, probably the best beer in the world"
td.
parksie
Aug 24th, 2001, 04:59 AM
Originally posted by Jay Rogozinsky
Msvcrt.dll contains calls such as strlen, printf, malloc, puts, etc. Msvcrt.dll has been succeeded by Msvcrt20.dll, Msvcrt40.dll, etc.
If you use those calls, you are using Msvcrtxx.dll. This dll, and likely some of the successors, will exist on ALL Windows systems. This is why you don't have to worry about them being there and your code always seems to work.
Only if you write very simple programs will no DLL calls be made. For instance, a simple variable increment in C requires NO outside calls - it can simply be an INC instruction on the processor.
Now, is it possible to have a compiler extract (some or all) of this code from the DLL and put it into a stand alone EXE? Yes. Does C let you do this - I don't know.
Even if it does, it does not negate the point. Both VB and C give you access to standard calls and those calls are not your code - they exist in a support DLL.
So your 'self-contained' program still relies on C library code - no matter if it's stripped into your EXE or not.
If you can, and do, put this code into your own EXE you are defeating the purpose of DLL's and also you are disallowing your end-users from upgrading a potentially buggy DLL call (i.e. even if they upgrade their Msvcrtxx.dll - your program will still exhibit the bug). VC++ has linker options. You can either link with the DLL stub library, or use the ACTUAL static library. The default is in fact to use the static library so if you use the normal settings you don't need any DLLs other than the system ones. And yes, it needs library code, but you can strip a lot of that out by writing your own _mainCRTStartup function and being careful (you also need to rewrite a few of the library functions but you can get them from the source if necessary). This makes stupidly small executables with no external dependencies (other than the system).
spetnik
Aug 24th, 2001, 08:11 AM
Originally posted by Jay Rogozinsky
Yes, let us not forget that C also utilizes a runtime DLL.
VB has always been a great place to slap off a conversion utility or such.
Dont forget all these banks, financial companies, insurance co.s, etc... that use VB. It is useful for internal database apps. As I have said many times though, when it comes to mainstream commercial apps, i challenge you to find a successful, decent one made in VB.
filburt1
Aug 24th, 2001, 08:13 AM
Well, it's not mainstream or that useful. (http://www.liquid2k.com/filburt1/). :D :D
parksie
Aug 24th, 2001, 08:20 AM
Heh :p
ericmuttta
Aug 24th, 2001, 03:01 PM
Wow this has just got to be the thread in town....lets keep talking.
Hooray Jay, thanks for your enlightenment. Gosh you had to write in machine code?!!???, that must have been fun huh? Well I am the moment am learning assembly language. I will need it for systems programming later on (early anouncement of the death of Windows and the birth of....I dunno but its coming no more crashes and BSOD's LOL.) Also this compiler that I am making for Ciyana will need the stuff.
You know you guys are right. Learning VB as a first language is fun but thats until you become proficient and start asking questions. I have been using VB for some time now and I wanted to know what on earth goes on within the chunks of silicon on my desk. You ask VB what Form.Visible=False means it tells you its gonna hide your form nnnnnnnnnnhhhhhhhhggggg!!!!! wrong answer its SendMessage(hWnd,SW_HIDE,0&,0&) (hope i got that right). Well those are the kind of answers I was looking for but good ol Vb just hides them. NOT FUN WHEN YOU REALLY WANNA KNOW WHATS UP. So I started learning windows programming. I have a windows skeleton program written using the API and a couple of BAS modules.Its about 400 lines long and all it does is register a window, show it,have two little menus and an empty About box .....HELLELUJAH FOR VB SOMETIMES.....you'd be surprised how much it really does for you. So anyway the point is I wanna go low level and know the real truth and C++, ASM all take the cake. Now i know why its never a good idea to use Goto statements (leads to flushing the prefetch queue on some pcs meaning data has to be fetched all over again) or how you can call a function give it a couple of bit values and have it work out what ORing/ANDing etc those bit values would produce without ever writing the expression. (boolean algebra..you gotta love the stuff). Plus theres more but hey thats for another day.
DONT ANYBODY STOP TALKING THIS DISCUSION IS FOR THE AGES I GOTTA GO BUT I WILL BE BACK. And yeah thanks for answering my efficiency question. Oh so does this mean the C++ compiler writers at microsoft are better than the VB ones??? HERE IS A SECRET EVERYONE, YOU KNOW THE VB COMPILER AND THE C++ COMPILER................SSHHHHHHHSSHHH THEY ARE THE SAME THING!!!!!!Tell you more later.(eric is taken away by a horde of guards from the secret Gates society nooooooooooo.....)
Now
kedaman
Aug 24th, 2001, 04:38 PM
You sure sound excited :p
Jay Rogozinsky
Aug 24th, 2001, 05:36 PM
Hooray Jay, thanks for your enlightenment
A lot of people here know more about C and VB than I do, but thanks. I know exactly how things work, just not the specifics in some cases.
Gosh you had to write in machine code?!!???
Ya. OMG. Hundreds of hand written pages containing OP CODES (1F, A9, ADC, MOV, etc). Everytime a serious correction was made, many of those pages were re-written. The code was entered with dip-switches. HeHe. I built a significant amount of the electronics too. I worked on the same stuff Bill Gates started on. S100 bus type systems (the name IMSAI rings a bell, or something like that). 8080 and 80x88 processors (the pre 80x86 stuff) - then some Z80 processors too were used. The only sound we had was turning on a standard radio and listening to the loops execute (by the system generated electrical noise). Memories! :-) And yes, it was a blast.
It was around this period that we made the rocket sled (playing with science and physics) - but thats another story.
HERE IS A SECRET EVERYONE, YOU KNOW THE VB COMPILER AND THE C++ COMPILER................SSHHHHHHHSSHHH THEY ARE THE SAME THING!!!!!!
I can see the Linker being the same ... but the compiler? Neat.
aknisely
Aug 24th, 2001, 11:34 PM
Originally posted by Jay Rogozinsky
I worked on the same stuff Bill Gates started on. Then why aren't you a billionaire?
Jay Rogozinsky
Aug 25th, 2001, 12:05 AM
What makes you presume I'm not. :-)
Dillinger4
Aug 25th, 2001, 12:25 AM
blah compile blah blah boot sector... 1:23 and Im drunk........
:p
aknisely
Aug 25th, 2001, 12:36 AM
Originally posted by Jay Rogozinsky
What makes you presume I'm not. :-) Cuz I ain't seen yer name in Forbes.
Ha!
ericmuttta
Aug 30th, 2001, 02:53 PM
Hello people, I have returned. So what have I missed?
Well Ciyana is going on well and I had some insipiration today on thoughts about the execution and debugging of programs. Does anybody know where I can get material on debuggers and intepreters? I need to know how they work so I can use them for Ciyana.
So far about the intepreter I have the following ideas.
Variables and the likes will be stored in files during the intepretation of code.
When the code refers to a variable,using some specialised routines,I can read the values as they are in the files, work on them and store the results back in the files.
Built in functions will be implemented as follows.Say the code reads: a = Sqrt(b). What I would do is the following. From the file, I would read the current value of b into a vb variable say an integer. I would then call the Sqrt function (which I would write myself) to get what the result is. Then the value would be saved to file where "a" has its space.
My current code library contains over 3000 lines of code (about 81 string functions ,rougly 30 mathematical functions, 10 logical functions and 4 sort and search functions) Yep I have been writing this library for the past 6 months and everyday it continues to grow. I intend to include it as part of the Ciyana runtime libraries. Ciyana by the way is going to be very powerful when it comes to text processing.Why? what do compilers,word processors, browsers, intepreters etc work with? TEXT TEXT TEXT. The more functions there are to deal with text the better.I have functions to select individual words,swap them, move them, replace them,expand them,encrypt them, analyse facts about them etc. All this is to be used for the Ciyana compiler itself.
If anyone wants any of it, as soon as I can get it into a DLL ,I can mail you a copy(let me know at: ericmuttta@email.com)
So then people lets share our ideas about how compilers and intepreters work. I will return and we can start right with VB itself.Meanwhile keep chatting and see ya. Eric.
spetnik
Aug 30th, 2001, 02:56 PM
Originally posted by aknisely
Then why aren't you a billionaire?
cuz gates didnt do jack $hi7. He just bought the rite stuff at the rite time
aknisely
Aug 30th, 2001, 09:23 PM
Originally posted by spetnik
cuz gates didnt do jack $hi7. He just bought the rite stuff at the rite time Yeah, so? What's stopping you from doing the same?;)
sail3005
Aug 30th, 2001, 09:44 PM
it's too late now.
Skitchen8
Aug 30th, 2001, 11:30 PM
ok... scam time *salesman voice: "if you send me and infinite amount of money in the mail i will send you a time maching (actualy a wooden box with batteries in it).
ericmuttta
Sep 4th, 2001, 02:43 PM
Hello people, I have returned. So what have I missed?
Well Ciyana is going on well and I had some insipiration today on thoughts about the execution and debugging of programs. Does anybody know where I can get material on debuggers and intepreters? I need to know how they work so I can use them for Ciyana.
So far about the intepreter I have the following ideas.
Variables and the likes will be stored in files during the intepretation of code.
When the code refers to a variable,using some specialised routines,I can read the values as they are in the files, work on them and store the results back in the files.
Built in functions will be implemented as follows.Say the code reads: a = Sqrt(b). What I would do is the following. From the file, I would read the current value of b into a vb variable say an integer. I would then call the Sqrt function (which I would write myself) to get what the result is. Then the value would be saved to file where "a" has its space.
My current code library contains over 3000 lines of code (about 81 string functions ,rougly 30 mathematical functions, 10 logical functions and 4 sort and search functions) Yep I have been writing this library for the past 6 months and everyday it continues to grow. I intend to include it as part of the Ciyana runtime libraries. Ciyana by the way is going to be very powerful when it comes to text processing.Why? what do compilers,word processors, browsers, intepreters etc work with? TEXT TEXT TEXT. The more functions there are to deal with text the better.I have functions to select individual words,swap them, move them, replace them,expand them,encrypt them, analyse facts about them etc. All this is to be used for the Ciyana compiler itself.
If anyone wants any of it, as soon as I can get it into a DLL ,I can mail you a copy(let me know at: ericmuttta@email.com)
So then people lets share our ideas about how compilers and intepreters work. I will return and we can start right with VB itself.Meanwhile keep chatting and see ya. Eric.
ssampson
Feb 21st, 2006, 11:13 PM
C\C++\VB\PERL - yada yada yada
How many out there rememeber when programming was really programming - the syntax and librabries have gotten so huge it's hard to remember everything all the time
Granted that just could be the age factor - and perhaps the woodstock effect
I miss OS/8 octal assembler 32K magnetic core memory and a power bill that would have brought down ENRON two years earlier.....
but THAT is just MY opinion - won't even buy a coffee
hehe
Cheers
zaza
Feb 22nd, 2006, 02:12 PM
I miss OS/8 octal assembler 32K magnetic core memory and a power bill that would have brought down ENRON two years earlier.....
...and even then, Enron would still have been alive and well when the last person before you posted in this thread.
wossname
Feb 22nd, 2006, 02:24 PM
ASM rules. I can't claim veteranship of ancient hardware but I did once write a mouce accelerator in ASM on my atari ST when I was 8.
ssampson
Feb 22nd, 2006, 05:25 PM
OK - so... well....... um...........
Sometimes when you are browsing for a solution you stumble on stuff -
For an old dude like me, 2001 was yesterday - you just WAIT until your bowels go - then you'll know - you'll understand.....
Whippersnapper....
;-)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.