PDA

View Full Version : How long do I have to.............



RobR
03-19-2002, 01:16 PM
Just out of interest (and partly to encourage / discourage me) how long does it take before C syntax becomes second nature. What I mean by this is that I have problems getting my ideas into a program 'cos the syntax gets in the way. It's difficult to get things to flow when you have to keep looking back at old source to remember where you put the #defines or {}'s or ;'s last time!

I've been programming in C for 20 years and it's still a problem (only kidding, it's been around 6 months, but not solidly).

nvoigt
03-19-2002, 01:27 PM
Depends on you, but for me it took 2 to 3 years for it not to matter anymore. It just flows now...

RobR
03-19-2002, 01:52 PM
Hmmmmm...... 2 1/2 years to go then!:D

Did you find it equally frustrating? If I had any hair, I'd tear it out.

(BTW, Thx for the reply)

Brian
03-19-2002, 02:00 PM
I've been programming C on and off for about 5 years. That is, I started 5 years ago, but probably one or two of those years I skipped programming altogether. I still have trouble.

Here are some common mistakes I make:



/* incorrect */
if(a = 1)
/* correct */
if(a == 1)

/* incorrect */
int main(void);
{
...
}
/* correct */
int main(void)
{
...
}

/* incorrect */
int a == 1;
/* correct */
int a = 1;

/* incorrect */
if(a == 1);
/* correct */
if(a == 1)

/* incorrect */
printf("hey")
/* correct */
printf("hey");



Semicolons are evil.

RobR
03-19-2002, 02:05 PM
Semicolons are evil.

LOL - I've lost count of the number of times I've "thrown a few extra ones in" and let the compiler find them!

VirtualAce
03-19-2002, 02:43 PM
It took me about 2 years. There are still some C++ syntax issues that get confusing for me every now and then, but not often.

-KEN-
03-19-2002, 02:48 PM
With C it took me less than a year, but even now every once in a while I get syntax errors (barely ever) but even the most experienced coders can't avoid them.

nvoigt
03-19-2002, 03:13 PM
Well, it's not like I don't make mistakes anymore. But after some years, syntax itself is something that just happens to be the means to make the computer do what you want. Errors happen, but after a while, you spot them easier, and if you find them, it's more like "D'oh, how could I do that" instead of wondering why the compiler complains.

Real knowledge about syntax comes when you think about building a compiler or interpreter. This is the time when you can predict syntax of things totally unknown to you. To some it may seem weird when you stand beside them looking at their screen, telling them that their script won't work that way without even knowing what language it is. And all you can explain about this is that "well... i don't know this language, but if I had build that syntax, you would get an error for that statement, because it would be a pain in the a## to implement the compiler if this were correct".

Barjor
03-19-2002, 03:20 PM
I Been doing this for two years on and off and I stil do the syntax blunders but it's not really because i don't know how to do it but more that they just slips buy. My biggest thing is that I have a hard time to remeberwhat all the getchar() printf() cin<< toupper and all that stuff do and what are there arguments. I always have atleast one book open when I am coding.

DavidP
03-19-2002, 03:25 PM
When I started learning C++ several years ago I had just come from a BASIC background, so the idea of semicolons was just plain weird to me.

It took me a little bit to get used to them, but I'd say after a year, maybe a year and a half, semicolons were second nature.

Of course all of us, whether of 5, 15, or 40 years, still miss the occasionall semicolon.

Prelude
03-19-2002, 03:58 PM
It took me about two weeks to understand the usage of the syntax and about 6 or 7 months to get a real feel for the structure of the language. However, as nvoigt said, understanding how compilers break down syntax into machine language helps a great deal.

-Prelude

Robert
03-19-2002, 05:16 PM
> When I started learning C++ several years ago I had just come >from a BASIC background, so the idea of semicolons was just >plain weird to me.

To me too: I couldn't understand why they want me to do only one statement in a line!? Now I know.
BTW, does't not seem that ; approaches to : ? Its 'basic', anyway. More, they stay in the same position.

The only problem with semicolon is when they are far right, so not visible in the editor.

Does anyone know what 'a:=7' ?
My first manual was Pascal. I read first two chapters before I got my first C++ DOS compiler. I forgot the book, and later, donated. Never reopened.


>A horse is a horse. There is no excuse for Hungarian notation.

Perfectly agree. I understand that a C++ compiler is case sensitive and there a less and less words for you to pick (they all gone for TradeMarks and domain names, so they protected :-) ), but to choose such a language that aliens won't waste time to learn, is pure ego(geocentr)ism. Maibe we are not alone in the universe, but we can sleep in tranquillity. They won't upgrade us to their OS, they'd wipe and repartition.
Me, for myself, don't use sleeping pills, but Borland C++ Builder.

Nice dreams and happy coding.

Sorensen
03-19-2002, 05:21 PM
>Me, for myself, don't use sleeping pills, but Borland C++ Builder.

Yeah, but possessing Borland products in my country carries a five year prison sentence. 12 if they can prove intent to supply.

Robert
03-19-2002, 05:27 PM
>Yeah, but possessing Borland products in my country carries a >five year prison sentence. 12 if they can prove intent to supply.

What you mean?! What country do you live and what's da reason for it?


Hoping you're joking
Robert

Sorensen
03-19-2002, 05:32 PM
>what's da reason for it?

The lawmakers say Borland destroys the fabric of society and cause brain damage. However, there's an active underground market.

Robert
03-19-2002, 05:54 PM
Well, i'm too new in this job, and you know: ignorance is bliss, love is blindness and so on...I'm so enthusiastic about that you might be right, I'm the one that does not see the broken bridge. Well, open my eyes!

Maybe the hungarian notation which I have troubles handling , I would need not a C book, but a H dictionary :-)

BCB fits better for what I know. Seen da visual that it is able to do ans passed to run time creation of controls. I think it would take about six days to release my opera... As far as remember, there was another one with a 6 dayz task: would it be Bjarne?
BTW, I have a post on the C++ board, maybe you'll take a look... (Create event for run-time button?)

I might have to do a brain check, though...

sorry for da REMark, but semicolon is really nothing compared. Being on the keyboard, always in your eyes, how could one forget? Hint: type one extra, never knows.

tim545666
03-19-2002, 11:45 PM
Hmmm I don't see how you can go too long without getting used to ;'s and {}'s. I did a school year of qBASIC and this year I'm doing C++. At the beginnig I pretty much refused to use semicolons and never used the ==. But now I'm really used to it and I kick myself in the ass when I forget to do something little like that.

BTW what the hell is hungarian notation?

novacain
03-19-2002, 11:55 PM
Hungarian notation is putting a letter code in frontof a variable name to show its type
ie int iVar;

I use it in WIN32 to tell the difference between things like a HBITMAP or BITMAP that relate to the same *.bmp. Or when I am using strings and ints in an array.


if(iIndex==iItem1)
{
sprintf(szBuffer,"%s %s",sArray[iIndex],sItem1);
}


If your app is a few pages no problem. If it is a few hundred pages, not all written by you, or you have been working on it for a over a year, I would suggest using it.

But is personal taste.

Prelude
03-20-2002, 12:47 AM
>I would suggest using it
*shudder* I wouldn't suggest it, what if the program specs change and you have the sole duty of changing every little occurance of iVar to fVar? Hungarian notation is useful in identifying the data type, but it binds the variable too closely to the type. Which makes for nasty maintenance.

-Prelude

novacain
03-20-2002, 02:22 AM
Thats what ctrl-h (replace) is for.
I have an app that finds and replaces strings in .c, .h, .cpp ect files in given folders for just such occurences.

As I write small, contained functions to one thing and avoid using globals, changing a variable name is not that hard.

Nutshell
03-20-2002, 07:37 AM
Once you look things up a few times you'll remember it. It's just when you go through a chapter and not do any of the exercises that you forget the syntax.

RobR
03-20-2002, 08:47 AM
Once you look things up a few times you'll remember it. It's just when you go through a chapter and not do any of the exercises that you forget the syntax

!!!Guilty as charged:D

Robert
03-21-2002, 05:32 PM
>At the beginnig I pretty much refused to use semicolons and >never used the ==.

Well, excusable ==, it's not even eroneous, just woun't get the expected, but how compile without ;?

> But now I'm really used to it and I kick myself in the ass when I >forget to do something little like that.

Beware, a 'visual' example is very strong! How would you like to see your surgeon doing something like this? It's not like you would not come back to him, it's like you might not leave.

>BTW what the hell is hungarian notation?
Am I not the only one using BCBuilder here? What are you using anyway?

Robert

tim545666
03-21-2002, 08:16 PM
Microsoft Visual C++ 6.0, I should be getting vs.net soon.

Robert
03-22-2002, 11:17 AM
Then how come you managed to ignore the hungarian notation till now?

BTW, I am very interested in you opinion about .net. Is so much noise about, that I tend to think daonly major change is the name. Exept they might introduced some new notation?!...

Robet
___________________________
Da code that didn't ki'll make you stronger.

Unregistered
03-22-2002, 11:22 AM
Urrghhh!! Hungarian notation, I hate it. As if other peoples code isn't hard enough to read anyway...

I wont be getting .net yet, but thats only cos I cant afford it :(

tim545666
03-22-2002, 05:23 PM
I don't buy software. If I had to pay for it, I would definetly stick to dev.

Robert
03-22-2002, 06:39 PM
>I don't buy software. If I had to pay for it, I would definetly stick to dev.

So, what a you using now if not paying for it? Are you coding for your own pleasure, or academical purposes? What do you do for living?

Robert

tim545666
03-22-2002, 07:11 PM
I'm a high school student, I use Visual Studio 6. I use it just to fool around with, but I keep it handy because I'm planning on starting some windows programming. The day I make a penny off of making a program using MSVC is the day I will buy the retail version.

Sekti
03-22-2002, 08:17 PM
I tried to do it but its to much of a waste of time and it makes it look bad I take pride showing people who cant program my code but hey I geuss iVar looks more computer like