Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Dark 'C'

Author
Message
TheAbomb12
21
Years of Service
User Offline
Joined: 14th Aug 2003
Location: Amist the blue skies...
Posted: 8th Nov 2003 22:45 Edited at: 8th Nov 2003 22:47
Hey guys,

I was thinking the other day, wouldn't if be cool if we could have all the ease of Dark Basic's functions wrapped up in the best programming lauguage know to man (C of course )? Well, I think it would be really cool if thegamecreators could make a 'C' version of Dark Basic Pro.

Personally, I really hate Basic as a core programming structure; there are a number of problems with Basic (mostly because its still a first generation language). These problems could be fixed by switching to the more reliable and faster syntax structure of C. If it is possible to have similar functions and abilities that Dark Basic has , "Dark C" could combine ease with robust power and effeciency...


If thegamecreators had a Dark C, I certainly would buy it.

what do you guys think?

Amist the Blue Skies...
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 8th Nov 2003 22:51
i sure this has come up before! just can't remember where.


Go on, click on my signature image, you know you want to
Favourite smiley>>>
MicroMan
21
Years of Service
User Offline
Joined: 19th Aug 2003
Location: Stockholm, Sweden
Posted: 8th Nov 2003 23:00
Well, speaking of first generation languages, I think Basic has a seniority of like five years over C... Basic was created at Dartmouth College in 1964 and C was created at Bell Laboratories in 1969.

Pascal is of course the kissing cousin of Basic, and one might as well request that instead, and in its present for it's as OOPL-ish as C++.

If it's structure and speed you want, then Pascal is probably better suited because with basic is supposed to be easy. It's one of the strong points of Dark Basic that it's easy. I could see, myself, that I'd want a more structured approach with the option explicit requirement from Visual Basic. I could also do with moore OOPL-ishness in the language, such as classes, inheritence, polymorphism.

Imagine that every time you created an object that all the code and data required for that object followed? I know that's just wishful thinking, but hey. And if there is a choice between OOPL-ishness and making Dark Basic much harder to learn and read, I'm all for ease of use.

-----
They SAID that given enough time a million monkeys with typewriters could recreate the collected works of William Shakespeare... Internet sure proved them wrong.
-----
Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 8th Nov 2003 23:11
maybe they can make Dark C libraries for other compilers, that might be just as usefull. Then they can release their own IDE.


Intel Celeron 1.3 Ghrz 512MB Ram NVIDIA GeForce FX 5200 128MB
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 8th Nov 2003 23:13
I know somebody (robk? ianm?) wrote a dll that allowed all of you C++ies to access DBP's functions, try a forum search.

"The trouble with the French is that they have no word for 'entreprenuer'" - Pres. George W Bush

Please visit http://www.davidtattersall.me.uk
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 8th Nov 2003 23:31
IanM - then you can use DBPro's 3D functions in C...


Avatar & Logo by Indi. Insert witty comment here...
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 8th Nov 2003 23:35
IanM and RobK, so similar

both flintstone avatars
both DLL makers
both 3letternamethenIntial

"The trouble with the French is that they have no word for 'entreprenuer'" - Pres. George W Bush

Please visit http://www.davidtattersall.me.uk
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Nov 2003 23:37
cue "Twilight Zone" theme....

do do do do, do do do do

-RUST-
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Nov 2003 00:20
You're all just jealous because we got these avatars first

You can find the interface library on my site
Akira Tsunami
20
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 9th Nov 2003 01:12 Edited at: 9th Nov 2003 01:14
i would like to see a DARK C++


OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Nov 2003 01:41
No need - get Visual Studio or GCC or something else, and the plug-in from IanM and voi la Dark C...


Avatar & Logo by Indi. Mirrors are more fun than television.
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 9th Nov 2003 02:15
I have no clue what to do with my C++ book and VS 6.0 Enterprise

Got a knack for finding secrets??? Jingot Racing---A new brand of Racing---Only from Nightwatch Studios
"hey, it's tomorrow" - Hamish
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Nov 2003 02:23
Might as well give it to me, especially the Visual Studio Enterprise.


Avatar & Logo by Indi. Mirrors are more fun than television.
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 9th Nov 2003 03:00
Why do people always think basic is easier than C? The only thing that makes it simpler is readability for a complete novice. For anyone with an inkle sprinkle tommy tinkle of experience, it's just a case of simple things like using { } to define blocks rather than END and stuff like that, or ............................... .... I have a stomach ache! WHAT DO I DO?!?!?!?!

Insiiiiiiiiiiiiiiiiiiiiiiiide!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Nov 2003 03:21
I think that a part of the problem is that there are a lot of macho C coders out there that code for unreadability, trying to see how many side-effects they can include in a single line of code.

I mean, assuming the variable 'a' is an integer with a value of 0, what will the following code display (be warned, this is a trick question)

printf("%d\n%d\n", ++a, a++);
MicroMan
21
Years of Service
User Offline
Joined: 19th Aug 2003
Location: Stockholm, Sweden
Posted: 9th Nov 2003 03:54 Edited at: 9th Nov 2003 03:58
Quote: "
printf("%dn%dn", ++a, a++);
"


Since it's C, and you never know what those ++ do when they're put in different sides of the argument, it would probably end with me tearing my hair out and running naked into the woods, screaming and singing.

Besides, what's wrong with

procedure madness
var
a: integer;
begin
a := a -1;
a := -1 - a;
end;

or something like that.

(This is not an attempt at a code solution to IanM's trick question, because about that I haven't got a clue. )

-----
They SAID that given enough time a million monkeys with typewriters could recreate the collected works of William Shakespeare... Internet sure proved them wrong.
-----
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 9th Nov 2003 03:58
I'm guessing it'd print 0. But I've never coded in C

--Mouse: Famous (Avatarless) Fighting Furball

A very nice %it, indeed.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Nov 2003 04:00 Edited at: 9th Nov 2003 04:03
That's actually not a part of the question

They work like this -

If they precede the variable, they increment the variable, then use its value.

If they follow the variable, then the initial value of the variable is used, and then the variable is incremented.

@Mouse, the code prints 2 values, but what will they be? I'm expecting a few wrong answers from C or C++ coders here, if they dare to guess, or even if they actually try it out ...

I'll check back here tomorrow and give the 'answer'
ESC_
21
Years of Service
User Offline
Joined: 29th Aug 2003
Location: Mass.
Posted: 9th Nov 2003 04:01
would it print zero and than two?

''For nonconformity, the world whips you with its displeasure''---Ralph Waldo Emerson
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 9th Nov 2003 05:02 Edited at: 9th Nov 2003 05:06
not sure if i'm loosing my mind, but TCA hasn't always been a forum moderator has he?

is the answer 11 by any chance... or atleast it would if ^_^
(doh! just realised my first answer would've been wrong, but still the second one stands - there is an if' something didn't prevent it)


To Survive You Must Evolve... This Time Van Will Not Escape His Fate!
900mhz | 256mb | FX5200Ti 52.16 | Dx9 | WXP-Pro
MicroMan
21
Years of Service
User Offline
Joined: 19th Aug 2003
Location: Stockholm, Sweden
Posted: 9th Nov 2003 05:16
But that would mean that first the value was incremented and then used, and then the value would be used and then incremented... So, the two 'a's would say the same thing. It would be the same number.

However, since I've got no clue as to what the arguments of the printf() function mean... What does the second and third position in the arglist do? I haven't got a clue. So I can't say what will show up.

-----
They SAID that given enough time a million monkeys with typewriters could recreate the collected works of William Shakespeare... Internet sure proved them wrong.
-----
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 9th Nov 2003 05:32 Edited at: 9th Nov 2003 05:34
Ok, I'm rusty with the old C too! So if A=0 ...

printf("%dn%dn", ++a, a++);

Now, I assume the trick is that we're all suppose to write that the answer is 10, as ++a mean increment by 1, then use (i.e. 1) and a++ means use and them increment (i.e. use a value of 0, but end up with 1).

So the answer would be "10" but there's a trick here.
Now, I think %d means print integer.
n means newline, if I remember rightly.
So we have:
1
0

Maybe the trick is in the printf statement. Can't remember all the different variations. Maybe printf is special. Anyways, you got me. I haven't used C in 2 years so I can't remember!

But then again, if A is already incremented, then the second value is already 1 ... uggggh. Meaning a gets set to 2 but is used as 1.

1
1

C++ is ugly when you use the ++'s!

Insiiiiiiiiiiiiiiiiiiiiiiiide!
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 9th Nov 2003 05:59
It's 11, the first 1 being incremented then used and then used again, then incremented. I think that's a pretty neat system .

--Mouse: Famous (Avatarless) Fighting Furball

A very nice %it, indeed.
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 9th Nov 2003 07:14
ya, maybe i should TCA,

seriously, even the pre-made ones that come with VS don't work

Anyone mind giving me some pointers on RUNNING A DANG APP (my book sucz)

Got a knack for finding secrets??? Jingot Racing---A new brand of Racing---Only from Nightwatch Studios
"hey, it's tomorrow" - Hamish
TheAbomb12
21
Years of Service
User Offline
Joined: 14th Aug 2003
Location: Amist the blue skies...
Posted: 9th Nov 2003 08:06 Edited at: 9th Nov 2003 08:12
Quote: "printf("%dn%dn", ++a, a++); "


Im going to take a stab...

the first ++a means to increment by 1 right away then print a newline:

1

The a++ means to increment after the c statement is finished, but before the increment takes place we need to print out a's current value of "1" so the answer is

1
1

however, a ends up with the value of 2

Quote: "I think that a part of the problem is that there are a lot of macho C coders out there that code for unreadability, trying to see how many side-effects they can include in a single line of code.
"


No...While im not "macho", I code for readability. And I hear (I have to experienced this myself) but professional programmers spend a lot of time making thier progams both elegant and readable because other team members need to be able to easily understand each other's code. Doing this saves a mint in maintenece costs of programs...

Quote: "No need - get Visual Studio or GCC or something else, and the plug-in from IanM and voi la Dark C..."

Well, there are plugins for basic, but that dosent make it Dark Basic or nearly as effective as DB.

If someone made a "Dark C" which included an easy to use IDE and many of the premade functons and abilites of DB, I think it would be pretty good.

BTW, Im in the process of setting up that plugin, ill let you know how it goes.

Amist the Blue Skies...
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Nov 2003 08:53
I think its 1 1 but then value in memory for A is 2
I guess it would help if I knew any C at all! LOL
but I do remember what Ian said about the diff between ++A and A++

wonder what the prize is if I am right, I know....U6!

-RUST-
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Nov 2003 11:59 Edited at: 9th Nov 2003 15:56
IanM's puzzle doesn't really have an answer - as pre and post increment is used in a function, it is up to the compiler to decide whether to increase a first and then display it or display and then increase - for example VS could give a different value to Borland to GCC...


Avatar & Logo by Indi. Mirrors are more fun than television.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 9th Nov 2003 13:28
Quote: "I have no clue what to do with my C++ book and VS 6.0 Enterprise "


I thought you were the one who knew c++ and was going to develop for the gc? Or am I getting confused

"The trouble with the French is that they have no word for 'entreprenuer'" - Pres. George W Bush

Please visit http://www.davidtattersall.me.uk
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Nov 2003 14:00 Edited at: 9th Nov 2003 14:01
... and the prize for 'smart-ass of the week' goes to ... TCA (surprise! )

Except that it's even worse than he thinks. Generally, compilers will have a set rule for exaluation order (no guarantees even here though), but the compiler isn't the only thing playing around with the code. The optimisation phase can also switch things around depending on what code has preceded or followed it.

So even if you stick to a single compiler, there isn't really an answer
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Nov 2003 16:01 Edited at: 9th Nov 2003 16:06
Quote: "Except that it's even worse than he thinks"

Well, it was late when I wrote it... Might you, I didn't want to scare off anyone who is learning C - they might head towards the Dark Side of the C language.

As a side note - to commemorate me completing Max Payne 2 again, I've added a quote to my signature from 'the hit 90's series Address Unknown'


Avatar & Logo by Indi. Mirrors are more fun than television.
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 9th Nov 2003 18:13
Quote: "I thought you were the one who knew c++ and was going to develop for the gc? Or am I getting confused "


hehe, yes I was. Never got around to learning it. Man, I was idiot back then

/me Remembers the good old days

Got a knack for finding secrets??? Jingot Racing---A new brand of Racing---Only from Nightwatch Studios
"hey, it's tomorrow" - Hamish
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 9th Nov 2003 19:11


"The trouble with the French is that they have no word for 'entreprenuer'" - Pres. George W Bush

Mercenaries in Space demo @ http://www.davidtattersall.me.uk
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 9th Nov 2003 23:22
But only if it does the expected thing - there is no defined way of dealing with this sort of problem unfortunately.


Avatar & Logo by Indi. Mirrors are more fun than television.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Nov 2003 00:26
It's called 'Implementation defined behaviour' in the standard
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 10th Nov 2003 00:30
All hail lack of standards...


Avatar & Logo by Indi. Mirrors are more fun than television.
klariza
20
Years of Service
User Offline
Joined: 6th Nov 2003
Location: uk
Posted: 10th Nov 2003 00:36
now after reading this topic - especially the trick question part by Ian M was it?
thanx for overloading my brain....i have not got a clue about C programming - i much rather stick to BASIC ty, nice and structured and understandable.
(well it is in my view)

I am obsessed by Toasters - especially talking ones...bizaare really isn't it?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Nov 2003 01:37
The point wasn't to scare anyone off

It was simply a dig at the 'expert' coders out there that code like this :

printf("%d/n%d/n", ++a, a++);

instead of this :

++a;
printf("%d\n%d\n", a, a);
a++;

Which has a few extra characters in it and takes up two more lines, but is completely predictable on any C or C++ compiler.

@Divide by zero, did you mean 1 and 1? (Preincrement, fetch a twice, postincrement)
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 10th Nov 2003 02:47
personally i don't think you should print using variable in a print statement anyways, just me but too many languages bring up errant behaviour doing it.

Though personally i've noticed 2 standards C++ wise.
Microsoft Visual C++ & GCC

i know you can argue they're both C++, but microsoft's has so many little MS tweaks and touchs specially for its Windows Operating Systems and a hyper-sensitive error checker ... it really makes it totally different to use.

I mean it's like comparing DarkBASIC with Blitz3D, they both use the same core programming structures and are both BASICs. However they're totally different to use and compile in.


To Survive You Must Evolve... This Time Van Will Not Escape His Fate!
900mhz | 256mb | FX5200Ti 52.16 | Dx9 | WXP-Pro
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 10th Nov 2003 04:12
How do you print the value of a variable if you don't use it in a print statement then?

Insiiiiiiiiiiiiiiiiiiiiiiiide!
dreamweavermx
20
Years of Service
User Offline
Joined: 11th Nov 2003
Location:
Posted: 12th Nov 2003 16:48
cout<<"Hello world"
Anyway , if you want to make Dark C , it's have a DirectX wrapper named CDX which make write DirectX games a lot easy in C++

Nothing here ! Arggghhhh .....
adr
21
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 12th Nov 2003 22:14
Now look. We all know, that the answer to all our problems would be Dark PHP. It looks like C, but isn't as picky. Best of both worlds...

Can I ask you a Question?
What is it?
It's an interrogative form of sentence, used to test knowledge. But that's not important right now.
Chris K
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 12th Nov 2003 22:22 Edited at: 12th Nov 2003 22:22
I get it. I find it absolutely hilarious.

...and like that; he's gone...
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Nov 2003 22:32
That was so ... feeble, I'm really *really* tempted to delete it
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 12th Nov 2003 23:34
loma

Got a knack for finding secrets??? Jingot Racing---A new brand of Racing---Only from Nightwatch Studios
"hey, it's tomorrow" - Hamish
Dragoon
20
Years of Service
User Offline
Joined: 30th Oct 2003
Location: Spijkenisse, Nederland
Posted: 13th Nov 2003 14:48
%d/n%d/n <-- What in the world do those things mean?
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 13th Nov 2003 23:00 Edited at: 13th Nov 2003 23:02
%d = print an integer
\n = print a carriage return (and line feed if needed - depending on the compiler/computer)


Mirrors are more fun than television. Well, that was fun, in a not-so-fun sort of way...
Dragoon
20
Years of Service
User Offline
Joined: 30th Oct 2003
Location: Spijkenisse, Nederland
Posted: 14th Nov 2003 08:46
Thanks for explaining, TCA. Can't say it makes sense to me but guess I'll need to find me a book of C++ and the program itself if I want to have it make sense (although I could ask everything on the forum )

Login to post a reply

Server time is: 2024-09-20 18:29:48
Your offset time is: 2024-09-20 18:29:48