Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - C/C++ is easier then VB | |
Pages: 1 2 3Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
creaothceann

Red Paragoomba
Level: 11

Posts: 8/50
EXP: 5903
For next: 82

Since: 01-27-05

Since last post: 21 hours
Last activity: 21 hours
Posted on 03-30-05 11:37 AM Link | Quote
Originally posted by Squash Monster
And I always figured that a compiler would take your booleans and store eight to a byte and sort out the details on its own.

There are mechanisms like that, eg. "sets" in Pascal. But the overhead...
Parasyte

Bullet Bill
Level: 35

Posts: 395/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 03-30-05 11:47 AM Link | Quote
Originally posted by Squash Monster
And I always figured that a compiler would take your booleans and store eight to a byte and sort out the details on its own. A boolean type seems counter-productive any other way.

... That and it's easier to paint the house in VB because they give you a cart of spraypaint along with the hammer, whereas in C you have to file a dozen layers of beurocracy to figure out how you're supposed to paint your house in whatever state you're in. And people like paint for some reason.


Regarding the first paragraph; that is what my 'example B' identifies.
Regarding the second; that only applies to GDI. Painting in C is vastly easier than VB, but it sort of depends on the implimentation. With Win32 GDI, prepare to face the true wrath of Microsoft. With DirectX things begin to start getting easier. By the time you pull Microsoft's nipple from your mouth and use something like SDL, you'll find yourself painting in pure bliss, all the way to the finished product.


(edited by Parasyte on 03-30-05 01:48 AM)
(edited by Parasyte on 03-30-05 01:48 AM)
Squash Monster

New Age Retro Hippie
Togateiru Fohku Kohgeki!!
GRUNGE no HAMSTER otona bite
Peace love and turnpike!

Level: 40

Posts: 556/677
EXP: 430507
For next: 10802

Since: 03-15-04
From: Maryland (of the Country Between Canada and Mexico)

Since last post: 5 hours
Last activity: 5 hours
Posted on 03-31-05 07:30 AM Link | Quote
I'm aware. Thus the little bit about figuring out how you're supposed to figure out how it's done in your current state -- states being like operating systems. As to whether or not that could've been fine tuned a bit, probably by putting most of the beurocracy after figuring out what state you're in, I'm apathetic.

I think we misunderstood eachother on the boolean point, so I'll start by restating what I said and trying to be clearer.

I'd think that it should work something like this...

bool isFood = 0;
bool myBool = 1;
bool yourBool = 0;
bool myCowHasDentures = 1;
if(myBool) { ... }

precompiles to...

byte boolSet1 = 00000101;
if(boolSet1 & 00000100) { ... }

It's a shame that it's not that way (well, asuming I did that code right -- switching between rhetorical mode and programming mode is disorienting )
sloat

Level: 16

Posts: 38/85
EXP: 18044
For next: 2212

Since: 05-21-04
From: South Central Delaware

Since last post: 19 days
Last activity: 5 hours
Posted on 03-31-05 09:26 AM Link | Quote
you can sorta do that with structs. for example

struct test
{
bool one:1; //1-bit
char two:1; //1-bit
char three:6; //6-bits
};

test t;

and you can access them like:

t.one = true; //etc..


the statement "if (t.one)" will be assembled to an 'and' instruction, but the overhead of all this basically kills the advantage...and the point.

Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 1383/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 03-31-05 05:21 PM Link | Quote
Originally posted by sloat

struct test
{
bool one:1; //1-bit
char two:1; //1-bit
char three:6; //6-bits
};

test t;

and you can access them like:

t.one = true; //etc..


I got that in my GBA headers Structs are neat like that, ain't they?
Kitten Yiffer

Purple wand
Furry moderator
Vivent l'exp����¯�¿�½������©rience de signalisation d'amusement, ou bien !
Level: 135

Posts: 8991/11162
EXP: 28824106
For next: 510899

Since: 03-15-04
From: Sweden

Since last post: 3 hours
Last activity: 4 min.
Posted on 04-01-05 12:28 AM Link | Quote
Originally posted by Zem
Squash Monster wins the analogy award.
Indeed, and he is right too.

I hadn't tried VB nor C++, but I have done both Delphi and Java. And Java just made more sense for me. :/

I have been planning to learn C++, since it seems to be the most useful language. Java is too slow for alot of things, althought it isn't as sluggish as people tell me it is. And Delphi while it is faster than VB according to certain persons I talked to is... wierd.

And apparently C++ and Java is similar, which I understand. I do understand C++ by just reading it's code, even if I hadn't written anything myself.

And oh, I always hated basic. Tried the language and still don't like it.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 3971/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-01-05 12:31 AM Link | Quote
The thing about VB is it's easier to do the simple things a beginner would be doing. For example, consider how you would make a program that changes a label's text when you click a button in VB:
-Open the standard GUI editor, add a label and button.
-Double-click button, add code to change label's caption property.

Now compare that to C:
-Open whatever GUI editor, add a label and button.
-Save and compile the resource files.
-Add WinMain and message handler functions, and code to show the dialog.
-Add code to message handler to check for WM_COMMAND messages with specific hWnds and parameters, and call SetWindowText with some other specific parameters.
-Add code to close the dialog when the close button on the titlebar is clicked.

Don't even get me started on handling strings, either. C may be more powerful and easier when it comes to more complicated tasks, but VB is definetely easier to get started with.
Zem
You can be civil without being flowery, dipshits.
Level: 49

Posts: 1018/1107
EXP: 829398
For next: 54485

Since: 06-13-04

Since last post: 131 days
Last activity: 131 days
Posted on 04-01-05 04:34 AM Link | Quote
Originally posted by Kitten Yiffer
And apparently C++ and Java is similar, which I understand. I do understand C++ by just reading it's code, even if I hadn't written anything myself.

And oh, I always hated basic. Tried the language and still don't like it.
One thing that I had trouble with in C++ even when I was doing fine with Java is pointers. I never got pointers. I'm sure they're easy once you know how they work, but I have yet to find a tutorial or book that explains them in a way I understand. (If anyone can link me to something like that, I'd love it.)

Also, I like Apple ][ Basic. I don't like Visual Basic. Apple ][ Basic is simple and consistent. Visual Basic has so many more functions that it's extremely inconsistent (from what I've seen) and unwieldy. It actually seems more complicated to me than C++.

P.S. the title of this thread should contain "than" rather than "then"
Dish

Spiny
Level: 38

Posts: 317/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-01-05 05:11 AM Link | Quote
Originally posted by HyperHacker

Don't even get me started on handling strings, either.



What really is so hard about strings? Seriously -- give me an operation VB does something with strings that can't be done in one line of code in C. A search and replace operation is the only thing I can think of.
Parasyte

Bullet Bill
Level: 35

Posts: 401/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 04-01-05 07:02 AM Link | Quote
Disch, there are no examples of that; everything can be abstracted via function calls. This goes a bit deeper than "well this is possible..."; even standard libs use functions to abstract certain string operations, such as getting the length of a string, or copying/appending strings. None of these operations consist of one line, internally. (Unless you write multiple statements on a single line, of course.)

My point is, there is nothing hard about handling strings; you only have to know a bit about what is going on behind the scenes.
Dish

Spiny
Level: 38

Posts: 318/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-01-05 07:53 AM Link | Quote
Well I meant to the casual C coder. Yes the string functions contain more code which is outside your program, but then it's the same with VB operations.

Even if someone doesn't fully understand the concept of a string (that being that it's nothing more than an array of characters) they can still perform basic string operations with the standard string functions. Sure a deeper meaning helps (and is very valuable) -- but it isn't really necessary.


char myString[80 + 1]; // a string which can hold 80 characters (plus null)

strcpy( myString, "Set the string to something." );

if( !strcmp( myString, "Compare this string with myString" ) )
{
}

strcat( myString, "Append this string to the end of myString." );


I mean really -- that's not difficult. I don't see what all the fuss is about.
interdpth

Rex
Level: 36

Posts: 424/527
EXP: 294398
For next: 13712

Since: 03-20-04

Since last post: 10 days
Last activity: 31 days
Posted on 04-01-05 10:25 AM Link | Quote
String functions are evil for comparing I just go:
char *string1;
char *string2;
long a,b;
a = (string1,NULL, 10);
b = (string2,NULL, 10);
if (a == b)
{
blahaah
}



(edited by interdpth on 04-01-05 12:26 AM)
Dish

Spiny
Level: 38

Posts: 320/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-01-05 10:47 AM Link | Quote
Originally posted by interdpth

a = (string1,NULL, 10);
b = (string2,NULL, 10);



Did something get cut out from your post? Because these two lines make no sense.

But anyway, what's wrong with strcmp and strcmpi? They do the job nicely.
interdpth

Rex
Level: 36

Posts: 425/527
EXP: 294398
For next: 13712

Since: 03-20-04

Since last post: 10 days
Last activity: 31 days
Posted on 04-01-05 01:04 PM Link | Quote
oh haha forgot to add strtol to it
Kyoufu Kawa
I'm not bad. I'm just drawn that way.
Level: 70

Posts: 1385/2481
EXP: 3008456
For next: 7355

Since: 03-19-04
From: Catgirl Central

Since last post: 14 hours
Last activity: 13 hours
Posted on 04-01-05 08:09 PM Link | Quote
Today, while coding Catnip, I realised I needed another function that would be in any C library but mine. So I wrote my own simple string comparison. It was very easy and I just realised that the exact operations it uses now would take twice as many lines of code in VB to emulate. How rare.
Dish

Spiny
Level: 38

Posts: 321/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-01-05 08:57 PM Link | Quote
interdpth:

That's not string comparison, that's number comparison =P

I mean if you have a string that says "house" and other string that says "shoe" --- if you'd want to see if they both say the same thing, you'd use strcmp().

PS - this bork bork bork thing really sucks -- some lame april fools joke or something?


(edited by Disch on 04-01-05 10:58 AM)
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 2836/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 04-02-05 04:34 AM Link | Quote
yeah, it is an april fool's thing--i was never into april fools

as for what interdepth did, his method works under strict conditions--after all fundamentally, comparision in computers is comparing bits...
alte Hexe

Star Mario
I dreamed I saw Joe Hill last night
Alive as you and me
"But Joe you're ten years dead!"
"I never died" said he
"I never died!" said he
Level: 99

Posts: 3468/5458
EXP: 9854489
For next: 145511

Since: 03-15-04
From: ...

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-02-05 05:02 AM Link | Quote
STD r eazy to get if urnt a progrmming nerd n get pussy
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 2843/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 04-02-05 12:24 PM Link | Quote
what does that have to do with anything? i'm guessing nothing...

as for fun-loving, i'm never going to get some
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4007/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-02-05 12:47 PM Link | Quote
Oh god, Borkified code. XD

And sure, C's string handling isn't that bad, but compare to VB's. Str1 = Str1 + Str2. Const x as String = "Text omfg". Really simple stuff.
Pages: 1 2 3Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - C/C++ is easier then VB | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.014 seconds.