M Lewchuk wrote:...
>"Russ Williams" <ru...@algorithm.demon.co.uk> writes:
>
>>>Go with the flow, use C !
>
>>I agree. You need to know C for practically any programming,
>>so why learn something else first? It's the understanding
>>behind the code that's important...
>
>That's why a person needs to learn something else first.
Why? The ideas are the same. It's just more work for no
real gain.
>C is great in both power and versatility, but it does lack
>intelligibility to those not used to "thinking in programming
>terms".
For a short while.
>For a start, a language like BASIC or PASCAL would
>probably be better because it provides much more
>word-based as opposed to sign-based constructs.
True, but that should only be a problem for a few hours
or days.
>For example, once one gets used to BEGIN ... END,
>one can see that the {} in C do the same thing.
But how about FOR...NEXT? Why are these 2 words
related? You can see instantly that { and } go together...
Why can you have DO..WHILE and REPEAT..UNTIL
but not DO..UNTIL? Or REPEAT..WHILE?
Also, what is <> or :=?
Why are they better than != or ==?
All symbols in programming languages are arbitrary.
C's are a little more cryptic, but they can be learned by
rote just the same as any others.
>It's all a matter of teaching what concepts (BEGIN, end,
>VAR, CONST, FUNCTION, PROCEDURE, parameter
>passing) are used, in as "natural language" a setting as
>possible,
I don't know about you, but that would be getting on my
nerves very quickly. Why so much typing for such a simple
concept?
>then going to specifics in another language once a
>person learns basic programming concepts and the
>use of data structures.
But why is that better than writing C with lots of comments
and having a good book to explain what each word/symbol/
line does?
---
Russ
Now that is exactly what my problem is. I learned to use the
BASIC languages back in high school in the '80's, and for the
most part I love the language. Now that I want to learn C,
however, I find I lost patience with it. I always say "I already can
do that with VB5, so why would I want to try using the weird looking
complex way when I could simply use VB5 and be done with the
program. This works for simple stuff, but it's speed and optimization
one is trying to gain by using C++--or Assembly, for that matter.
I think learning BASIC first can make some people (like me) too
spoiled to get on with it once they want to learn C.
>
>True, but that should only be a problem for a few hours
>or days.
>
>>For example, once one gets used to BEGIN ... END,
>>one can see that the {} in C do the same thing.
>
>But how about FOR...NEXT? Why are these 2 words
>related? You can see instantly that { and } go together...
>Why can you have DO..WHILE and REPEAT..UNTIL
>but not DO..UNTIL? Or REPEAT..WHILE?
>
>Also, what is <> or :=?
>Why are they better than != or ==?
You're giving me a headache! Hey--maybe that's why I keep
closing the book??? :-))
>
>All symbols in programming languages are arbitrary.
>C's are a little more cryptic, but they can be learned by
>rote just the same as any others.
>
>>It's all a matter of teaching what concepts (BEGIN, end,
>>VAR, CONST, FUNCTION, PROCEDURE, parameter
>>passing) are used, in as "natural language" a setting as
>>possible,
>
>I don't know about you, but that would be getting on my
>nerves very quickly. Why so much typing for such a simple
>concept?
I couldn't agree more, personally!
rib :-)))
<snip>
> >then going to specifics in another language once a
> >person learns basic programming concepts and the
> >use of data structures.
>
> But why is that better than writing C with lots of comments
> and having a good book to explain what each word/symbol/
> line does?
>
> ---
> Russ
>
>
I agree with Russ here. I don't think in general that it matters so much what
language you begin to learn. Maybe PASCAL can be slightly eaiser because of
the usage of english over symbols.
But after a very short while (IMO) the real learning curve for the student has
to so with learning the general theorems of programming, what constraints the
langauge has, etc. When that point comes, you might as well learn APL, as
whatever syntactical tokens you use becomes less relevant than the ideas they
express.
A stronger reason to begin with (if the language you begin with is of no large
importance) C is that it is _very_probable_ that all other languages the
student will use in a game programming career will use constructs similar to C
in many ways.
Peter Svensson
Hillarium
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
> M Lewchuk wrote:...
> >"Russ Williams" <ru...@algorithm.demon.co.uk> writes:
> >
> >>>Go with the flow, use C !
> >
> >>I agree. You need to know C for practically any programming,
> >>so why learn something else first? It's the understanding
> >>behind the code that's important...
> >
> >That's why a person needs to learn something else first.
>
> Why? The ideas are the same. It's just more work for no
> real gain.
Yes, the ideas are the same, but Basic and Pascal are somewhat easier to
learn than C (IMHO). Plus, as you learn more languages, each next one
becomes easier to learn - this will make it easier to make the transition to
C if you already know a language or two.
> >C is great in both power and versatility, but it does lack
> >intelligibility to those not used to "thinking in programming
> >terms".
>
> For a short while.
True, but that time might be a little longer if you jump right to C with
little or no prior programming experience. I had known Basic for a long time
before making the transition to C, and I was very glad for my knowledge in
Basic. If I didn't know Basic so well, it would have been very hard for me
to pick up on C - besides learning the syntax, I'd also have to learn how and
why to use for loops, if thens, etc.
> >For a start, a language like BASIC or PASCAL would
> >probably be better because it provides much more
> >word-based as opposed to sign-based constructs.
>
> True, but that should only be a problem for a few hours
> or days.
Also, at least from what I've seen, Basic languages seem to set up the
environment more for the user. In C, you have to do everything - the
compiler does nothing for you. That's definitly a plus that it's that way,
but for the beginning that can be a big downsie. I first learned C on a Mac
(yes, a Mac - I've now converted over to Win95 programming exclusively), and
before that I know Basic on the Mac. In the Basic language I was using, it
only took a few minutes to set up a working program with few menus and a
window. However, in C, that took a considerably longer time because I had to
do everything myself - which would have been impossible had I not had my
experience with Basic.
> >For example, once one gets used to BEGIN ... END,
> >one can see that the {} in C do the same thing.
>
> But how about FOR...NEXT? Why are these 2 words
> related? You can see instantly that { and } go together...
> Why can you have DO..WHILE and REPEAT..UNTIL
> but not DO..UNTIL? Or REPEAT..WHILE?
True, those keywords don't seem to go together, but look at the syntax of a
for statement in C, and compare that to a FOR statement in Basic - don't you
agree that Basic's FOR statement is much more legible for the beginner?
<snip>
> >It's all a matter of teaching what concepts (BEGIN, end,
> >VAR, CONST, FUNCTION, PROCEDURE, parameter
> >passing) are used, in as "natural language" a setting as
> >possible,
>
> I don't know about you, but that would be getting on my
> nerves very quickly. Why so much typing for such a simple
> concept?
But all that typing adds extra readability for the beginning programmer. No
need to remember what each and every little symbol is, you can just look at a
keyword and remember quickly.
> >then going to specifics in another language once a
> >person learns basic programming concepts and the
> >use of data structures.
>
> But why is that better than writing C with lots of comments
> and having a good book to explain what each word/symbol/
> line does?
I don't know about you, but commenting isn't one of my strong points. I'd
guess that it wouldn't be for a beginner, either - and if you forget a very
important comment in C, you could be in trouble, especially if you're a
beginner - why not just rely on the language's keywords (which have to be
there anyway) to aid in memory, instead of relying on heavy commenting (which
could be forgotten)?
Just my two cents,
--
andy9701
"Behold...a two headed dog, born with one head!"
-Police Chief Wiggum, The Simpsons
My current advice for a language to first *learn* programming is Java,
though actually implementing your programs has lots of problems.
But next to that, I'd put C. I must admit, I knew basic and pascal first,
so I can't be a fair judge. But basic and pascal were both always awkward
for me. It really seems that the ease-of-use modifications made it more
awkward. The good thing about C is that it's relatively transparent. When
something is transparent, it's easier to learn.
My opinion, but if I were to start teaching a novice, I'd skip basic and
pascal and start with C or Java.
+---------------------------------------------------------------------+
| Timothy O'Neill Dang/Cretog8 |
+--------------+------------------------------------------------------+
| 505-843-6966 | tim...@nmia.com | http://www.nmia.com/~timothy/ |
+--------------+------------------+-----------------------------------+
| One monkey don't stop no show |
+---------------------------------------------------------------------+
I don't agree. I think that C is even easier to learn for some people. I
didn't have any problems learning C because it's got a syntax that's quite
mathematical. There are no exceptions. If you can do something you can do it
in any context (for example with every data type). I think for people who
think in a kind of scientific / mathematical way (like me) C is easy to
learn.
On the other hand I didn't like Pascal from the start and I didn't stick to
it for very long. After I wrote REPEAT WHILE a few times I got annoyed by
the compiler delievering an error. Pascal just doesn't have strict rules
that apply to everything. Why in god's name do you have to use UNTIL after
REPEAT and can't use WHILE? Why are there such exceptions? It's a little bit
like having to learn a new (real) language and remembering that you don't
use BECAUSE but AS at the beginning of a sentence.
No one will convince me that this is easier to learn than the fact that you
use { at the start and } at the end of ANY block of code. You can use these
right in the middle of a function. Without any FOR or something, just
because you want this code to be treated as a block. This is very useful in
makro definitions and it also shows that C has no such exceptions as Pascal
has.
And why should I want to type BEGIN and END (press 8 keys) if I can use
and } (press 2 keys)?
>For a
>start, a language like BASIC or PASCAL would probably be better
>because it provides much more word-based as opposed to sign-based
>constructs. For example, once one gets used to BEGIN ... END, one
>can see that the {} in C do the same thing. It's all a matter of
>teaching what concepts (BEGIN, end, VAR, CONST, FUNCTION, PROCEDURE,
>parameter passing) are used, in as "natural language" a setting as
>possible, then going to specifics in another language once a person
>learns basic programming concepts and the use of data structures.
I think this "natural language" business is not a real argument. I mean, no
one can just sit down on a chair and enter in natural language what the
program should do. In Pascal you also have to learn what FOR does, what you
need to write behind it and and where you have to use BEGIN and END. To
learn Pascal you have to remember "at the beginning of a procedure I have to
write BEGIN, not BEGINNING or START" and in C you have to learn "at the
beginning of a function and for and while and do and try and every bunch of
code that belongs together I have to type {".. In Pascal you also have to
learn which specific word to write after FOR, which to write after DO and so
on. So, what's easier to learn?
So, all I can say is that I never understood why a lot of people think that
Pascal is easier to learn than C. But I also don't understand why many
people hate math in school. So perhaps I'm just limited to a mathematical
point of view. Convince me if you can :)
By the way: perhaps we should take this thread to
comp.games.development.programming.misc? It doesn't fit in here.
> Plus, as you learn more languages, each next one
> becomes easier to learn - this will make it easier to make the transition to
> C if you already know a language or two.
That's all very nice but for most people is redundant. I don't know one person
who codes purely for fun that wishes he could learn another language. They all
stuck with the one they started with and are happy. I imagine that a lot of other
recreational developers are the same although I admit it would be different for
those wishing to pursue a career in programming.
> True, but that time might be a little longer if you jump right to C with
> little or no prior programming experience. I had known Basic for a long time
> before making the transition to C, and I was very glad for my knowledge in
> Basic.
But then, noone can really comment on this sort of thing as you cannot try it
both ways and therefore cannot form a non-biased opinion on it.
Personally, I found it very simple to dive straight into Windows/C++/DirectX
coding.
> If I didn't know Basic so well, it would have been very hard for me
> to pick up on C - besides learning the syntax, I'd also have to learn how and
> why to use for loops, if thens, etc.
How long would that take you, honestly? A couple of hours to learn the lot?
Probably. A little more for for() loops, maybe as they are a little more complex.
> True, those keywords don't seem to go together, but look at the syntax of a
> for statement in C, and compare that to a FOR statement in Basic - don't you
> agree that Basic's FOR statement is much more legible for the beginner?
Probably but only for a very little while. If the beginner is _very_ stuck they
could try something like this:#define AND &&
#define OR ||
etc. That may hurt more than it helps but it's an idea.....
> But all that typing adds extra readability for the beginning programmer. No
> need to remember what each and every little symbol is, you can just look at a
> keyword and remember quickly.
See above :)
> I don't know about you, but commenting isn't one of my strong points.
Then you should really work on it. Lots.
Michael K
Why is that? JAVA's resembles very much the one used in C++. But JAVA has
IMHO quite a few disadvantages for beginners. There is for example this
hidden-pointer business. Every variable in JAVA (except the simple types)
represents a pointer on an object. It's very hard to explain to a newbie
that if you copy the variable you don't copy the object but get a another
reference to the same. So if you modify the object via one variable it will
also be different if you address it via the other variable. BUT this is
different for the simple types. With them you get a copy. In C++ this a more
transparent: when you have a pointer or a reference you have a pointer or a
reference and when you have an Object you have an Object :)).
And there's also the issue with the many bugs in JAVA. I got annoyed very
quickly when finding out that some VMs don't work like they are supposed to
do. A good example is how the arguments you pass to Scrollbars are treated.
Microsoft's JView treats the 'maximum' value as the maximum position for the
left / upper side of the visible area but Sun's VM treats it as the maximum
position for the right / lower side of the visible area (or was it the other
way round?).
So you see JAVA always involves a little more try and error because the
documentation does not always tells you the right thing. And of course this
example shows that JAVA is not THAT much of a cross platform language if an
application doesn't even behave in the same way on one and the same platform
:). (I have to add that what I stated above belongs to JDK 1.1.3. I don't
know if these problem's have been solved in later releases - but I doubt it
;))
>But next to that, I'd put C. I must admit, I knew basic and pascal first,
>so I can't be a fair judge. But basic and pascal were both always awkward
>for me. It really seems that the ease-of-use modifications made it more
>awkward. The good thing about C is that it's relatively transparent. When
>something is transparent, it's easier to learn.
Yep. That's exactly my opinion.
>My opinion, but if I were to start teaching a novice, I'd skip basic and
>pascal and start with C or Java.
I think you should start with C++ and some easy examples. People always say
that C++ is more complex than Pascal. That's not true. C++ allows you to do
more things than Pascal but when learning C++ you don't have to use all
these features. If you stick to the basics for a while and then SLOWLY
introduce the newbie to the more advanced features of C++ there should be no
problem. After all you don't have to use all the possibilities C++ gives to
you.
The one thing against Java is that it is completely object oriented. True, it
would be good to get the novice working with objects from the ground up, but
then again it might be a little too much for him to take in at the same time.
That's why most people wouldn't start off by learning C++ - you have to learn
the language and the oop features at the same time, which could be a big mess.
I will agree with you, though, on the fact that Java would be a somewhat
better "learning" language than C - you can't do as much damage to your
computer accidently, for example.
Agreed. But you can learn that with any language, so why
is C a better/worse choice than anything else?
>And second, don't try to learn programming with a "true"
>programming language like C or Pascal or anything like
>that. You still have to know a lot about the computer
>instead of focusing on learning to program. For instance,
>have you ever seen the code to put a Bitmap on screen
>in C?
What does that have with learning to program? It's platform
specific and nothing to do with the language.
>Man, if you're a beginner, you really don't understand
>what's going on there. Then you should have something
>like -> put_picture_on_screen(x, y), so you don't have to
>worry about Videomemory and memory device contexts.
There are all sorts of libraries that are that simple.
It's only about 6 lines to use GDI under Windows. Sure,
the meaning is complex, but isn't that the case with
everything if you pry deep enough?
>So, I recommend learning to program in DBASE (hehe,
>didn't expect that right?) Create a database, perform
>some actions on it depending on the user's choice and
>show some nice pictures. Here, you don't have to worry
>about memory and algorithms. I think this is best......but
>who am I?
So, what exactly are you learning? Other than dBase?
---
Russ
You are kidding, right? Are you seriouesly saying that C is just as easy to
learn as the next language?
>>instead of focusing on learning to program. For instance,
>>have you ever seen the code to put a Bitmap on screen
>>in C?
>
>What does that have with learning to program? It's platform
>specific and nothing to do with the language.
Its about what you really want. Learn how to drive or learn how to buil a
Ferrari from scrap metal.
>So, what exactly are you learning? Other than dBase?
Programming.
Hello there: I find this discusion very interesting since I got my original
game programing experience in Basic and to a lesser extend in Pascal and that
was in the 80's. I did no actual coding since (only game concept and
interface design). Now, I want to get back into game programming and
obviously I need profesional advice! (This post isn't ment to change the
topic of this discussion, only to pose a more specific question withing its
framework).
The game I want to write:
-cerebral strategy game;
-taking place in true 3D;
-geared towards internet;
-with multiplayer support 2-30+;
-possibly a voice support com. link btw the players;
Target market: -Win 95/98 environment.
Questions:
1. What programming languages and/or tools are best for the above task?
2. What extra goodies must be used to convert this PC product to a
"Playstation-type" market/platform.
All input is welcome - the more the better. Please mention your
experience level with your comments.
Many thank's, Vitaly.
> Timothy P O'Neill wrote in message <6s6nll$d...@hume.nmia.com>...
> >My current advice for a language to first *learn* programming is Java,
> >though actually implementing your programs has lots of problems.
>
> Why is that? JAVA's resembles very much the one used in C++. But JAVA has
> IMHO quite a few disadvantages for beginners. There is for example this
> hidden-pointer business. Every variable in JAVA (except the simple types)
> represents a pointer on an object. It's very hard to explain to a newbie
> that if you copy the variable you don't copy the object but get a another
> reference to the same. So if you modify the object via one variable it will
> also be different if you address it via the other variable. BUT this is
> different for the simple types. With them you get a copy. In C++ this a more
> transparent: when you have a pointer or a reference you have a pointer or a
> reference and when you have an Object you have an Object :)).
>
> And there's also the issue with the many bugs in JAVA. I got annoyed very
> quickly when finding out that some VMs don't work like they are supposed to
> do. A good example is how the arguments you pass to Scrollbars are treated.
> Microsoft's JView treats the 'maximum' value as the maximum position for the
> left / upper side of the visible area but Sun's VM treats it as the maximum
> position for the right / lower side of the visible area (or was it the other
> way round?).
>
> So you see JAVA always involves a little more try and error because the
> documentation does not always tells you the right thing. And of course this
> example shows that JAVA is not THAT much of a cross platform language if an
> application doesn't even behave in the same way on one and the same platform
> :). (I have to add that what I stated above belongs to JDK 1.1.3. I don't
> know if these problem's have been solved in later releases - but I doubt it
> ;))
>
> >But next to that, I'd put C. I must admit, I knew basic and pascal first,
> >so I can't be a fair judge. But basic and pascal were both always awkward
> >for me. It really seems that the ease-of-use modifications made it more
> >awkward. The good thing about C is that it's relatively transparent. When
> >something is transparent, it's easier to learn.
>
> Yep. That's exactly my opinion.
>
> >My opinion, but if I were to start teaching a novice, I'd skip basic and
> >pascal and start with C or Java.
>
> I think you should start with C++ and some easy examples. People always say
> that C++ is more complex than Pascal. That's not true. C++ allows you to do
> more things than Pascal but when learning C++ you don't have to use all
> these features. If you stick to the basics for a while and then SLOWLY
> introduce the newbie to the more advanced features of C++ there should be no
> problem. After all you don't have to use all the possibilities C++ gives to
> you.
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
That sounds ambitious for someone who may not have too much current
Win95/98 game programming experience. As is constantly recommended
here, if you're a beginner, start off with something *simple*, get
good at that, and then work your way up from there. If you already
have a design document speccing out the game, I'd recommend doing JUST
the first point above for starters-- no 3D, no netplay, just a game.
Get that working first, then you can upgrade the graphics and add
netplay later.
>Questions:
>1. What programming languages and/or tools are best for the above task?
If there's highspeed action, C/C++ is really your best
choice. Visual Basic may be ok for rapidly prototyping a 2D engine,
but isn't very portable. Java may be nice, but currently isn't as fast
as C/C++, and the 3D capabilities are currently weak.
There are some 3rd party internet voice-comm products being worked
on and/or on the market-- it'll save you a lot of trouble to simply
recommend products X, Y or Z, rather than trying to build an audio
compression engine from scratch.
>2. What extra goodies must be used to convert this PC product to a
>"Playstation-type" market/platform.
I'd highly stress coding in C/C++ for this-- compilers exist for
those languages. [Java and VisualBasic are out] None of the current
consoles really has any netplay capability, and voice input is
similarly right out.
If you want to start programming a console, and have some $ to
spare, go to http://www.scea.sony.com and look up their Net Yaroze
setup-- a Playstation you can develop for from your PC.
Nathan Mates
--
<*> Nathan Mates http://www.visi.com/~nathan/ <*>
# What are the facts? Again and again and again-- what are the _facts_?
# Shun wishful thinking, avoid opinion, care not what the neighbors
# think-- what are the facts, and to how many decimal places? -R.A. Heinlein
Michael Kissin wrote:
> andy...@hotmail.com wrote:
>
> > Plus, as you learn more languages, each next one
> > becomes easier to learn - this will make it easier to make the transition to
> > C if you already know a language or two.
>
> That's all very nice but for most people is redundant. I don't know one person
> who codes purely for fun that wishes he could learn another language.
Me.
> They all
> stuck with the one they started with and are happy. I imagine that a lot of other
> recreational developers are the same although I admit it would be different for
> those wishing to pursue a career in programming.
Of course, I have a career in programming as well ;)
> Probably but only for a very little while. If the beginner is _very_ stuck they
> could try something like this:#define AND &&
> #define OR ||
> etc. That may hurt more than it helps but it's an idea.....
ANSI C++ has the keywords
and and_eq bitand bitor compl not or or_eq xor xor_eq not_eq
You just might confuse more experienced programmers if
you use them, though.
--
Acy James Stapp | ast...@slamsoftware.com | 'Amp' 3D Engine
Slam Software | http://www.slamsoftware.com |
Just to focus, programming in itself is not the issue, the end product, a
program is what we want to achieve. The language used makes no difference
to the computer, it's just a nice way for us to do stuff.
I personally think that skill of computer programming is a thing which is
independant of the language used. Any programmer could pick up the
fundamentals of a new language in an afternoon. I've compiled a list below
of languages I'm familiar with and the ease with which they can be learned.
Basic. The most inappropriately named language ever. It has most things
you might want so it's certainly not a *basic* language. It has a very
english structure (eg. If - then - endif) and makes learning how programatic
structures operate very clear and simple.
Pascal. Designed specifically for teaching programming (as far as I
remember my history). A very structured language which certainly helped
instill good discipline in me. Provides a nice introduction to tricky
subjects like memory allocation and pointers.
xBase. A database programming language. Very similar to basic in concept
and structure with the addition of intrinsic database functionality.
C. A powerful lower level language which has all of the same structures as
other languages above, but represents them in a more crypic fashion.
C can be tricky, even experienced programmers can make the simplest of
mistakes (eg using = when you mean ==).
I personally feel (though this may just be because I started on an 8bit
computer with built in basic) that basic is an excellent starting point for
learning to program. No-one expects to write doom in basic but the
programming skills learned in basic will certainly not be lost when moving
to a more powerful language.
--
Colm G
Thats funny, I've never heard of a language called C/C++... I've heard
of C and also C++, but never this strange beast!
;-)
But its the same as write(), the differencein trivial. Most likely the
poster just forgot that.
-G. Howland
> ANSI C++ has the keywords
> and and_eq bitand bitor compl not or or_eq xor xor_eq not_eq
I did not know that :)
> You just might confuse more experienced programmers if
> you use them, though.
Probably. Hehe.
Michael K
Surely this is a reason to use C from the start. If you
use BASIC or Pascal first, you'll be used to '=' being
a test, or there being no difference between an
assignment and a test. Starting with C, you'd learn
the difference between = and == and bitwise/logical
operators.
---
Russ
I was actually being sarcastic.
> Neither is particularly readable to the uninitiated.
>
> How can 'i = i+1'? If that's an equation, it's just not possible. The =
> sign in an equation is not an assignment, but a statement of equality;
> that is, it is commutative. 'i + 1 = i' would have the same meaning.
i = i + 1 is a very simple statement. If someone cant figure out
that that could very well mean add 1 to i then they have bigger
math problems then we need to worry about in just teaching
them programming.
Yes, they could assume its a comparision, but when does
something equal itself plus one? Never as far as I know
since that defies the identity principle.
In the context of
i = 0; i < 9; i = i +1
I think it can fairly easily be deduced that i = 0 is a statement
setting i to 0. i < 9 mean i is less then 9, and i = i + 1 means
your adding 1 to i. Put these together in a for() statement
and just by the properties of the english language you have
a condition for i to be less than 9, starting with 0, and
adding 1s to it.
-G. Howland
http://www.hient.com/
Geoff Howland wrote:
putchar(c) is the same as putc(c, stdio).
C is a _character_. The aforementioned loop
would generate a number of control characters.
What you need is putchar(x+'0') // for ascii
or putchar("0123456789"[x]) // to confuse people or for ebcdic
or {
char buf[15];
itoa(x, buf, 10);
puts(buf);
}
or printf("%d", x);
Really? Have you found a compiler for this "C++" language? I
can only find "C/C++" compilers :)
--
Thatcher Ulrich
http://world.std.com/~ulrich
It's C divided by C++, which means it's got to be less than both of them
:-)
--------------------------------------------------
psy...@nthfen.demon.co.uk
'In Ankh-Morpork even the shit have a street to itself...
Truly, this is a land of oppurtunity' - Detritus, Men at Arms
>> Neither is particularly readable to the uninitiated.
>>
>> How can 'i = i+1'? If that's an equation, it's just not possible. The =
>> sign in an equation is not an assignment, but a statement of equality;
>> that is, it is commutative. 'i + 1 = i' would have the same meaning.
>
>i = i + 1 is a very simple statement. If someone cant figure out
>that that could very well mean add 1 to i then they have bigger
>math problems then we need to worry about in just teaching
>them programming.
Perhaps I can provide a "relatively inexperienced" perspective. I first
learned Fortran (a long, long time ago), then switched to basic (got
somewhat proficient then quit), and only recently decided to get back into
programming and started looking at C/C++ (don't claim to know C/C++ yet).
I think any command will seem simple once you've mastered the particular
language. However, to me, i = i + 1 is comes much closer to being
intuitively obvious as a command to increment by i by 1 than does i++.
Anyway, that's my 2 cents - and probably worth less. :)
regards,
Jon
Why ? I've never seen them before and I'm pretty sure I know what they
mean. In fact here's a table of what I think they mean :
ANSI C++ | ANSI C
-----------------------------------------------
and | &&
and_eq | &=
bitand | &
bitor | ||
compl | ~
not | !
or | |
or_eq | |=
xor | ^
xor_eq | ^=
not_eq | != or ~=
My point is, most languages are fundamentally similar, once you know one
it's relatively easy to pick up another and these are fundamental operators
found in the majority of languages. Now, if things where the other way
round and C had always used the non-symbolic operators and C++ introduced
the symbolic versions, then there might be some room for confusion, but it
all comes down to syntax, all programming languages share the same basic
structural concepts (conditions, loops and branches) and it's just a matter
of learning the syntax.
--
Scott Hill
Sc...@DDLinks.co.uk
Software Engineer (and all round nice guy)
Company homepage : http://www.ddlinks.demon.co.uk
"The best trick the devil ever pulled was convincing people he didn't
exist..."
- Verbal Kint.
"the Internet is here so we can waste time talking about nothing in
particular when we should be working" - Marcus Hill.
Except, at the time it was developed, it was very aptly named. IIRC it was
one of the first higher-level languages, originally developed, like pascal,
as a teaching tool (BASIC actually means something like Beginners
All-purpose Simple Instruction Code (my memories a bit foggy here, so I
could be wrong)), and, compared to assembler or machine code, it was _very_
basic.
>
<more excellent stuff I wholeheartedly agree with>
Only if abs(C++) is greater than 1 and not both of them are negative.
I learnt basic in 1986 so I understand it very well, picking up vb was
a doddle.. but I'm considering developing skills in Delphi or C.
Paul
me...@clara.net
Scott Hill wrote:
> Acy James Stapp <ast...@io.com> wrote in article
I agree. It's mostly confusing the first time you see it and
realize "what the hell is 'and' doing in this code?"
It's also a wee bit confusing if you write perl as well because the
priorities of the operators are different, whereas they are synonyms
in C++.
Just to unfog your memory
BASIC = Beginners All Purpose Symbolic Instruction Code
Though I've got a sneaky suspicion they started with the word basic and
invented the acronym backwards :)
--
Colm
Visual Basic is certainly not a joke. Just ask the thousands of VB
programmers for whom it is their bread and butter (including me). VB *can*
be used to write bad code, just like any other language. Actually VB can be
used to write terrible code, but with proper discipline, code quality can be
very high, this is true for any language. It has it's problems, but the
benefits far outweigh anything anyone can come up with (a challenge?!?).
As for writing games... I use C. The main reason for this lies with Dr
Jobbs journal, almost all sample code is in C so it certainly pays to learn
at least the basics so that you can use the concepts.
--
Colm
Ahh good point! =)
The term "Visual Basic programmer" is about as nonsensical as "HTML
programmer".
IMHO, of course ;-)
They were used to make sure people with other (non-US) keyboards could
use the language. Some special characters can replace symbols like |
{} [] and others. For the same reason, there are the digraphs and
trigraph notations
(eg. <% %> <: :> %: %:%: ??= ??( ??< and some others) They are less
readable than the real ones, IMHO.
>
>> You just might confuse more experienced programmers if
>> you use them, though.
Guaranteed.
>
>Probably. Hehe.
>
>Michael K
>
Remove DONTSPAM from my reply address to send me mail.
Website: http://users.skynet.be/libaers (under construction)
Is this really different than ISO C (i.e. what
most people call ANSI C)? In ISO C they're #defines,
not keywords.
You have to #include <iso646.h> to get the
definitions, and it's no different than you
defining macros yourself. (E.g. you can
use the words 'and' and 'not' and 'or' as
variables if you want in a C program. You
just have to avoid including the appropriate
header, or else #undef them as needed.)
Of course you can *always* confuse experienced
programmers by #defining macros to replace standard
names, and that's all iso646 does.
Sean
Come on, it's silly to compare HTML to VB. I don't want to sound like I'm
burning a torch for VB, but it is definately an excellent programming
language. In many cases it's "object based" view of the world frees you
from the shackles of pure oop programming. To give you a recent example a
colleague had in work, judge for yourself if it is good or bad
... going outwith the scope comp.games.development.programming.misc for a
second, look the other way if this offends :)
In a multi tier database application, the client can be anywhere (internal,
dial-in, extranet (never sure what this means - internet w/ security in this
case)). Using ADO and requesting a single row from an oracle database
involves making at least 11 network packet exchanges (in real-life this can
go up to 33 or more). This is the pure object orientated method. When the
purity of oo is broken, all of the properties on the client side can be
placed in a "bag" (a variant array) and sent for the server in one go.
Reducing the number of network calls to 2 and improving performance all
round. VB is a programming language. VB Programmers certainly deserve the
name programmer.
... Anyway away from the GOOD (get out of debt) job and back to games
I do use C when I get home, it's nice to have a compiled exe with no
dependancies.
--
Colm
>Colm Gallagher wrote:
>> Visual Basic is certainly not a joke. Just ask the thousands of VB
>> programmers for whom it is their bread and butter (including me). VB *can*
>> be used to write bad code, just like any other language. Actually VB can be
>> used to write terrible code, but with proper discipline, code quality can be
>> very high, this is true for any language. It has it's problems, but the
>> benefits far outweigh anything anyone can come up with (a challenge?!?).
>
>The term "Visual Basic programmer" is about as nonsensical as "HTML
>programmer".
>
>IMHO, of course ;-)
Well, you obviously know nothing about it then
Paul Dormer
me...@clara.net
>The term "Visual Basic programmer" is about as nonsensical as "HTML
>programmer".
That's nonsense. IMHO.
Justin Heyes-Jones, just...@hotmail.com.
Pascal :
= is a test
:= is an assignment.
BASIC:
= is a test
= is an assignment
What's your point?
---
Russ
> My point is, most languages are fundamentally similar, once you know one
> it's relatively easy to pick up another and these are fundamental operators
> found in the majority of languages. Now, if things where the other way
> round and C had always used the non-symbolic operators and C++ introduced
> the symbolic versions, then there might be some room for confusion, but it
> all comes down to syntax, all programming languages share the same basic
> structural concepts (conditions, loops and branches) and it's just a matter
> of learning the syntax.
I think you've overstated this a little. For example, Prolog
doesn't really have loops in the traditional sense. OO features
are often different across languages, and aren't universal.
Pascal is a very nice programming environment, at least for people who have
progressed from edlin as the IDE <G> (As in Real Programmers. It's a joke,
not an insult)
So when I see someone taking a potshot at it, and they are incorrect, I
reseve the right to correct it.
Russ Williams wrote in message
<904996945.5290.0...@news.demon.co.uk>...
Well, C++ is C incremented, so it's got to be larger, assuming you count -1
to be 'bigger' than -10. :-)
You are aware that "Real Programmers Don't Use Pascal"...
;)
---
Russ
Well, I don't really know Prolog (did a little in the AI of my degree),
but by saying "in the traditional sense" you imply that it has something
that acts like a loop, and I seem to recall it was possible, if fairly
difficult, to do loops, so it does come down, almost, to syntax. All you
need to know is _how_ to write a loop in a particular language, the way
loops work is universal.
> OO features
> are often different across languages, and aren't universal.
>
I never said anything about OO. OO isn't a "basic structural concept",
it's a very powerful and oft miss-understood programming technique that is
bound to have implementation differences across languages simply due to the
fact that it's a programming technique, not a structural concept (you can
write OO code in languages other than OO languages ).
Here's some sample Prolog-ish code for you (the syntax details
are probably way off from real Prolog).
factorial(0) :- 1.
factorial(i) :- i * factorial(i-1).
I took a course in college where I learned to program using this
functional style in Prolog and Lisp (no loops, no side effects).
While it's true that most widely-used Lisp dialects have a
construct that looks like a traditional loop, it's also true that
such a construct is not required in a programming language, and
is not universal.
And, of course, how many times have you had a bug such as saying:
if ( i = j )... when you meant "==" ? or:
i = j & k ... when you meant "&&" ? Mnemonics are easier to SEE,
and harder to screw up. (also requires more typing, of course!)
JK
Name an abstract idea or algorithm that can not be coded by a "paid"
programmer.
I agree that there is no such thing as HTML programmer.
<rest snipped>
--
Jay C., Programmer
Remove debug_ for replies
John O. Kopf wrote:
Actually, if you touch-type all of the typed equivalents are faster or
as fast to type, since you don't have to move off of the home row.
The *_eq ones are an exception.
> And, of course, how many times have you had a bug such as saying:
> if ( i = j )... when you meant "==" ?
Never. All the IDEs (plural, BCB3 and MSVC++5) I use catch that for me.
> or:
> i = j & k ... when you meant "&&" ?
Never. I just seem to be more careful than that and I follow good coding
parctices.
> Mnemonics are easier to SEE,
> and harder to screw up. (also requires more typing, of course!)
Yes but the increased typing makes them pointless. I don't really care for
them, myself.
Michael K
Get into the habit of putting constants or literials on the left side of
your comparison and you'll stop most of those bugs in their tracks.
e.g.,
if ( 0 == i ) {}
since
if ( 0 = i ) {} is invalid but if (i = 0 ) {} is not..
Ok, here's one abstract idea you'll never be able to code :
A system that will analyze a program and determine whether the it
terminates or not.
A good way to avoid the problem above is to put the constant
value on the left of the "==" operator (assuming a constant in the
comparison). e.g. if ( x == 1 ) {...} becomes if ( 1 == x ) {...}
This way, if you accidentally omit one of the = signs, the statement
will attempt to assign to a constant and the compiler will generate
an error.
---
Steven Dickson
While this does get rid of that problem, it is torturous reading that
code. It is kind of like reading the sentence "Sits on the blue chair
the box." Another approach that works for me, is to read == as
'equivalent to', and = as 'becomes'. If you train yourself, it is very
effective.
Of course, if you are programming simultaneously in two
languages, one using =, == and the other using :=, = life just sucks big
time (unfortunately I've been there more than I'd like).
Steven Dickson wrote:
> [snip]
> >
> >C can be tricky, even experienced programmers can make
> >the simplest of mistakes (eg using = when you mean ==).
> >
> [snip]
>
> A good way to avoid the problem above is to put the constant
> value on the left of the "==" operator (assuming a constant in the
> comparison). e.g. if ( x == 1 ) {...} becomes if ( 1 == x ) {...}
> This way, if you accidentally omit one of the = signs, the statement
> will attempt to assign to a constant and the compiler will generate
> an error.
> ---
> Steven Dickson
A better way to avoid the problem is to turn on the compiler warning
about it and avoid all use of = in the condition of an if statement.
That way you've got a 0% chance of it happening - your trick only
works if one of the values being tested is const.