View previous topic :: View next topic |
Author |
Message |
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Wed Jan 29, 2003 9:42 pm Post subject: |
|
|
Gnufsh wrote: | sed -f /GRDB/NG/sed.control < $argv[1] > drawM.345.c
cc -I/GRDB/NG /GRDB/C/*.o drawM.345.c -L/usr/X11R6/lib -lm -lX11 -lXext
\rm drawM.345.*
what does it mean? | sed stands for Stream EDitor, and it takes an input stream, applies some transformation rules to it, and writes it out. Think of it as a universal filter. sed.control contains a bunch of rules that take "Your Weird C Class Source Code Format" (TM) and spit out quasi-C to the file drawM.345.c. Then the quasi-C is further massaged by the macros in begin.h (to do the replacing of and with &&, etc) by the preprocessor, and compiled. It is linked with the Greatly Retarded Diminished Brainpower object files (that provide things like the implementation of outputstring()), to make an executable. Since I don't see an -o flag to cc, I'm guessing the resultant executable will be named a.out. Finally, it deletes the drawM.345.* transitory files THAT SHOULDN'T HAVE HAD TO BE MADE IN THE FIRST PLACE IF YOU WERE JUST ALLOWED TO WRITE NORMAL C! _________________ For every higher wall, there is a taller ladder |
|
Back to top |
|
|
ebrostig Bodhisattva
Joined: 20 Jul 2002 Posts: 3152 Location: Orlando, Fl
|
Posted: Wed Jan 29, 2003 11:31 pm Post subject: |
|
|
For someone who picked up most of his initial knowledge about C from Kernigan & Ritchie's C book back in the early 80's, this threads give me the creeps!
#include <stdio.h>
#include "begin.h"
Should be the correct way of doing it. If your scholl has a special header-file that defines or re-defines certain functionality, it should be put in a local header file and called with ".." not <..>. The <..> syntax in #include indicates a system wide, standard header file common to all. This is actually in line with normal C programming structure AFAIK.
Erik _________________ 'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.' |
|
Back to top |
|
|
BigRedDot n00b
Joined: 29 Oct 2002 Posts: 67 Location: Austin
|
Posted: Thu Jan 30, 2003 1:27 am Post subject: |
|
|
Quote: | Yeah I agree with the Scheme/Lisp advantages. I will resist the urge to say much more though as to not detract from the original topic. |
Right. Unfortunately noone ever starts the cool topics... _________________ Even if you are one-in-a-million, there are still 6000 people just like you. |
|
Back to top |
|
|
ryan83vt Guru
Joined: 28 Oct 2002 Posts: 370 Location: Blacksburg, VA
|
Posted: Thu Jan 30, 2003 2:14 am Post subject: |
|
|
hmm i didnt know anyone still took C anymore. I figured C++ had taken over C b/c you can basically do most C stuff but with more features.
At my school the intro C++ teachers hate java, and will resist switching to java if their lives depend on it. |
|
Back to top |
|
|
Zadeh Tux's lil' helper
Joined: 31 Oct 2002 Posts: 131
|
Posted: Thu Jan 30, 2003 12:26 pm Post subject: |
|
|
That begin.h stuff seems to be going a bit overboard with hand holding there.
Quote: |
Right. Unfortunately noone ever starts the cool topics...
|
It would be cool if in the middle of a thread, you could "branch" to a new topic and move anything not relevant to the original one there and form kind of a tree hierarchy. Might get a little crazy and messy though with too many branches. I guess just replying in this way means I blew it. :)
Quote: |
hmm i didnt know anyone still took C anymore. I figured C++ had taken over C b/c you can basically do most C stuff but with more features.
At my school the intro C++ teachers hate java, and will resist switching to java if their lives depend on it.
|
Lots of schools still use it and base their whole curriculum on it. There are years of experience and tons of good textbooks already written using it. Thats what its like where I'm at.
Here they previously have resisted switching to C++ and now Java. Before that I've heard they were even reluctant to switch from FORTRAN :) An interesting correlation is that here the CS dept. is a sub-branch of the Engineering dept. called "EECS."
Just a small ways from here is another univ. and their CS dept. is a part of their math dept. and they practically use a different language for every course (Scheme, SML, C, C++, Modula3, are ones I recall)!
So far as I can tell there is a high correlation between curriculums based on where the CS dept. is located and whether the school is public or private. |
|
Back to top |
|
|
aja l33t
Joined: 26 Aug 2002 Posts: 705 Location: Edmonton, Canada
|
Posted: Thu Jan 30, 2003 2:26 pm Post subject: |
|
|
BigRedDot wrote: |
"and" and "or" (and some others) are standard C++, which seems to surprise many people. |
Including me. You sure? I don't seem them in section 5 of the standard, but they may be mentioned elsewhere. I also don't find them in any of my keyword summaries - but that could be the authors of those summaries.
That being said, even if they are supported in the language, I doubt you'd find anyone who advocates their use (particularly becuase of the apparent confusion between bitwise and logical). And I still think those macro definitions are just wrong. They're like the platonic form of how not to teach someone C. |
|
Back to top |
|
|
BigRedDot n00b
Joined: 29 Oct 2002 Posts: 67 Location: Austin
|
Posted: Thu Jan 30, 2003 3:15 pm Post subject: |
|
|
Quote: | Including me. You sure? |
Yes, although I don't have a copy of the standard right now. Check section 2, there should be a subsection somewhere about alternative tokens and digraphs.
Quote: | That being said, even if they are supported in the language, I doubt you'd find anyone who advocates their use (particularly becuase of the apparent confusion between bitwise and logical). |
That's what "bitand' and 'bitor' are for.
Code: | Table 2--alternative tokens
+----------------------+-----------------------+-----------------------+
|alternative primary | alternative primary | alternative primary |
+----------------------+-----------------------+-----------------------+
| <% { | and && | and_eq &= |
+----------------------+-----------------------+-----------------------+
| %> } | bitor | | or_eq |= |
+----------------------+-----------------------+-----------------------+
| <: [ | or || | xor_eq ^= |
+----------------------+-----------------------+-----------------------+
| :> ] | xor ^ | not ! |
+----------------------+-----------------------+-----------------------+
| %: # | compl ~ | not_eq != |
+----------------------+-----------------------+-----------------------+
| %:%: ## | bitand & | |
+----------------------+-----------------------+-----------------------+ |
Quote: | And I still think those macro definitions are just wrong. They're like the platonic form of how not to teach someone C. |
We agree. _________________ Even if you are one-in-a-million, there are still 6000 people just like you. |
|
Back to top |
|
|
aja l33t
Joined: 26 Aug 2002 Posts: 705 Location: Edmonton, Canada
|
Posted: Thu Jan 30, 2003 4:13 pm Post subject: |
|
|
BigRedDot wrote: |
Yes, although I don't have a copy of the standard right now. Check section 2, there should be a subsection somewhere about alternative tokens and digraphs.
|
Found it. Section 2.5, if anyone cares. Thanks - Nice to learn new things. Apparently, the trigraphs and digraphs are there to support environments where some of the standard characters may not be available from the keyboard. |
|
Back to top |
|
|
Zadeh Tux's lil' helper
Joined: 31 Oct 2002 Posts: 131
|
Posted: Thu Jan 30, 2003 8:08 pm Post subject: |
|
|
Yeah, they are there for i8n support. Never seen them actually used though. |
|
Back to top |
|
|
uglyman Apprentice
Joined: 21 Apr 2002 Posts: 216 Location: Seattle, WA USA
|
Posted: Fri Jan 31, 2003 12:14 am Post subject: |
|
|
Quote: | Apparently, the trigraphs and digraphs are there to support environments where some of the standard characters may not be available from the keyboard. |
Thanks for mentioning this I was reading along and wondering why until you said that. Now it makes sense. I think that I might have even seen "and, or" in the text book we used last quarter
later
-ug |
|
Back to top |
|
|
snakattak3 Guru
Joined: 11 Dec 2002 Posts: 468 Location: Seattle
|
Posted: Fri Jan 31, 2003 7:58 am Post subject: similar |
|
|
I had a teacher when i first started cs, in C, that did something like that for file i/o. She made a library called <fileio.h>, and we had to use that syntax to use it too, not what you would think "fileio.h". And the syntax for it was really easy too. Instead of using pointers for file i/o, we could declare them like this,
textFile file;
and use them like this,
file = openFile("whateverfile.txt", READ);
or use WRITE to write to the file, and such. She also had a nextLine() function, that you would use to get to the next line in the file. This screwed me for my next CS class down the road. Well, not really screwed me, but it set me back because I had to re-learn file i/o the right way. I'm sorry your teacher uses <begin.h>, that sounds even worse that what I had to go through. My suggestions, you should learn on your own the normal/notsohandholding way so you really know whats going on, it'll be better on if you persue cs. Anyways, thats just my 2 cents. |
|
Back to top |
|
|
S_aIN_t Guru
Joined: 11 May 2002 Posts: 488 Location: Ottawa
|
Posted: Fri Jan 31, 2003 8:15 am Post subject: Re: similar |
|
|
snakattak3 wrote: | I had a teacher when i first started cs, in C, that did something like that for file i/o. She made a library called <fileio.h>, and we had to use that syntax to use it too, not what you would think "fileio.h". And the syntax for it was really easy too. Instead of using pointers for file i/o, we could declare them like this,
|
We have a similar situation. The only difference is the language. In our into classes the teacher provides you with a "somethingOrOther" class file. All the IO you should use, is in that file. Although i feel that it is a bad aproach, I think it is justified in this case. Noone wants to teach Java IO when trying to explain what a "for" or "if" is. _________________ "That which is overdesigned, too highly
specific, anticipates outcome; the anicipation of
outcome guatantees, if not failure, the
absence of grace."
- William Gibson, "All Tomorrow's Parties"
----
http://petro.tanreisoftware.com |
|
Back to top |
|
|
asimon l33t
Joined: 27 Jun 2002 Posts: 979 Location: Germany, Old Europe
|
Posted: Fri Jan 31, 2003 2:11 pm Post subject: |
|
|
Quote: | One of the particularly broken pedagogical philosophies it seems to demonstrate is the idea that i/o in C, C+ and Java is 'too difficult' for beginning CS students. Consequently, they wrap the i/o in "easier" functions. |
If you do some programming language semantics, type theory, or have to prove the corectness of your program with mathematical precision, and thinks like that you'll like to start easy. Thinks become complicated soon enough Of course, if they never leave the simple phase it is indeed bad.
I think it doesn't help much if a student just learns C or C++. He can do this with a good book and some practice at home in very short time. Better he learns programming, programming language paradigms, design patterns, various object systems and the resulting different programming paradigms, the pitfalls of covariance and invariance, fundamentals about type systems, etc... Such knowledge is very helpful and is worth having in practice. On the university I studied we had the slogan: "nothing is more workable than a good theory". Practice is very important and valuable, but theoretical knowledge in addition only helps.
So I think that it can be helpful to start easy (as for example with trivial i/o functions).
Cheers,
Andreas[/i] |
|
Back to top |
|
|
BigRedDot n00b
Joined: 29 Oct 2002 Posts: 67 Location: Austin
|
Posted: Fri Jan 31, 2003 2:25 pm Post subject: |
|
|
Quote: | One of the particularly broken pedagogical philosophies it seems to demonstrate is the idea that i/o in C, C+ and Java is 'too difficult' for beginning CS students. Consequently, they wrap the i/o in "easier" functions. |
Surely, trying to use I/O functions in C and (and the pointers and odd syntax they necessarily entail) when you don't know basic ideas about iteration and data is difficult. And completely upside down and backward. At best you can memorize "what sort of works" by rote, for the time being, without any real understanding. At worst you conflate general ideas about programming and data that should be applicable anywhere in any language with the peccadilloes of a particular language. I agree that wrapping I/O functions is a craptacular solution. The solution is to not use C or C++ as beginner languages in the first place, because they are awful in that capacity. _________________ Even if you are one-in-a-million, there are still 6000 people just like you. |
|
Back to top |
|
|
HighwayStar n00b
Joined: 01 Jan 2003 Posts: 26 Location: Montreal, Quebec, Canada
|
Posted: Fri Jan 31, 2003 5:01 pm Post subject: |
|
|
IMHO, i think that C++ should be used to create the application framework, and output library (GUI or text) should be used to create the interface. This way, one could write a program's backend in C/C++ and create I/O with ncurses,readline,qt or even Python,Perl, ... whatever library/language suits the need.
But it's IMHO. Only my 2c
Enjoy programming _________________ holyshit.org :
AMD Athlon XP 2100+ w/ 512MB PC-2700
MSI KT3-Ultra2R
Using 2.4.20-gentoo-r1/gcc-3.2.2/athlon-xp
[img:d6d9cf3ab1]http://art-team.ca/n.laplante/img/powered-by-gentoo.jpg[/img:d6d9cf3ab1] |
|
Back to top |
|
|
Zadeh Tux's lil' helper
Joined: 31 Oct 2002 Posts: 131
|
Posted: Fri Jan 31, 2003 9:36 pm Post subject: |
|
|
asimon wrote: | ...
I think it doesn't help much if a student just learns C or C++. He can do this with a good book and some practice at home in very short time. Better he learns programming, programming language paradigms, design patterns, various object systems and the resulting different programming paradigms, the pitfalls of covariance and invariance, fundamentals about type systems, etc... Such knowledge is very helpful and is worth having in practice. On the university I studied we had the slogan: "nothing is more workable than a good theory". Practice is very important and valuable, but theoretical knowledge in addition only helps.
|
I don't see how you can teach someone about programming, "programming paradigms," design patterns etc without first giving them experience with a programming language. I don't know anyone who's ever learned that way and I doubt you did either.
Like many others I think after you've learned those things you're tempted to present those who would follow the same path with your conclusions and expect they can arrive there without undergoing a similar process, but you've taken for granted how you arrived at where you are and that you only came to view things in such a way in retrospect.
Theory only arises as the result of practical experience. One can quibble about how best to accomplish the experience; what language(s) to use, tools and environment(s) etc but those are peripheral issues to how one learns. |
|
Back to top |
|
|
aja l33t
Joined: 26 Aug 2002 Posts: 705 Location: Edmonton, Canada
|
Posted: Fri Jan 31, 2003 10:43 pm Post subject: |
|
|
Quote: | One of the particularly broken pedagogical philosophies it seems to demonstrate is the idea that i/o in C, C+ and Java is 'too difficult' for beginning CS students. Consequently, they wrap the i/o in "easier" functions. |
I should clarify that, when I wrote the above, the point I was trying to make was that the idea of teaching a language like C by wrapping up the difficult bits was fundamentally flawed. However, I do agree that the question of whether or not C/C++ (or even Java) are appropriate for beginning CS students is still an open one.
My department teaches C++ to our first-year students, and in fact we have considerable success with that method. We do, however, have a bit of an advantage because our students are Computer Engineering Technologists - so they are simultaneously taking courses with Microprocessors, assembly language, etc. C++ is a good tool for instructing them in CS theory.
However, every once in a while, one of us will suggest replacing the first course with a different language that offers a bit more abstraction than the more nuts-and-bolts C++. And the reasoning is, I think, valid. Unfortunately, it often devolves into me attempting to defend Python as an introductory language over VB.... |
|
Back to top |
|
|
aja l33t
Joined: 26 Aug 2002 Posts: 705 Location: Edmonton, Canada
|
Posted: Fri Jan 31, 2003 11:09 pm Post subject: |
|
|
Oh...something else.
In the first C++ course, our students do not do ANY console I/O for the first several weeks. Instead, assignments and labs are done in the debugger - where they assign variable values and inspect the results.
It's somewhat odd, but we reap the benefit of forcing them into the debugger (which greatly helps later), and not having to deal with I/O until they have a little experience under their belts. |
|
Back to top |
|
|
BigRedDot n00b
Joined: 29 Oct 2002 Posts: 67 Location: Austin
|
Posted: Sat Feb 01, 2003 12:04 am Post subject: |
|
|
Zadeh wrote: | I don't see how you can teach someone about programming, "programming paradigms," design patterns etc without first giving them experience with a programming language. I don't know anyone who's ever learned that way and I doubt you did either. |
Right, I never suggested that a person can learn about programming without actually doing programming. If that's what came across then I obviously expressed myself very poorly. I only meant to indicate that I believe some of the languages often chosen to introduce people to programming are perhaps not well suited to that particular task, because they force people to cater to alot of minutiae that really has very little to do with learning (and it does need to be learned) the mental process of constructing an algorithm to solve a problem.
And I am not talking about high-flying "academic theory" here, either, just to be clear. That mental skill (problem solving) is what is emminently and univerally practical, and it needs the most practice and attention in the beginning, IMHO. We've all seen code written by people who "could write language X" but was awful, because they did not know how to approach the problem. It does little good to have a shop full of tools and materials, even if you "know how they work," if you can't figure out the steps to build the chair in the first place. _________________ Even if you are one-in-a-million, there are still 6000 people just like you. |
|
Back to top |
|
|
Zadeh Tux's lil' helper
Joined: 31 Oct 2002 Posts: 131
|
Posted: Sat Feb 01, 2003 9:42 am Post subject: |
|
|
BigRedDot, I'm a little confused. I wasn't replying to your message. :) |
|
Back to top |
|
|
BigRedDot n00b
Joined: 29 Oct 2002 Posts: 67 Location: Austin
|
Posted: Sat Feb 01, 2003 3:35 pm Post subject: |
|
|
Quote: | BigRedDot, I'm a little confused. I wasn't replying to your message. |
The prize for not reading careful is looking silly. I win!
I have been accused of pandering to "theory" and ignoring practicalities on occasion before, evidently it has made me defensive. _________________ Even if you are one-in-a-million, there are still 6000 people just like you. |
|
Back to top |
|
|
Zadeh Tux's lil' helper
Joined: 31 Oct 2002 Posts: 131
|
Posted: Sat Feb 01, 2003 6:17 pm Post subject: |
|
|
BigRedDot wrote: |
The prize for not reading careful is looking silly. I win!
I have been accused of pandering to "theory" and ignoring practicalities on occasion before, evidently it has made me defensive. :) |
Ah ok, so your mind was all ready to respond to that kind of thing. :)
I generally agree with many of your sentiments though:
Quote: | I believe some of the languages often chosen to introduce people to programming are perhaps not well suited to that particular task, because they force people to cater to alot of minutiae that really has very little to do with learning (and it does need to be learned) the mental process of constructing an algorithm to solve a problem. |
Playing the devils advocate here, how would you respond to the argument that you should be teaching someone the language they're most likely to be using when they're out of school -- the one that employers are looking for.
(Thats probably the most common kind of counter-argument I see when recommending something like Python or Scheme.) |
|
Back to top |
|
|
Zadeh Tux's lil' helper
Joined: 31 Oct 2002 Posts: 131
|
Posted: Sat Feb 01, 2003 6:35 pm Post subject: |
|
|
aja wrote: | ...
However, every once in a while, one of us will suggest replacing the first course with a different language that offers a bit more abstraction than the more nuts-and-bolts C++. And the reasoning is, I think, valid. Unfortunately, it often devolves into me attempting to defend Python as an introductory language over VB.... |
The top choices I see are usually:
C
C++
Java
Most of the programming a student does is probably simple enough that the choice between Java and C++ would probably comes down to considering things like how good the tools are. And when people recommend VB I think thats what they are thinking of.
In the fairly short-term future though there will be some big improvements in C++ tools from MS -- it will offer a VB and C#-like "windows forms" builder. Borland probably has one planned to target .NET coming soon too. |
|
Back to top |
|
|
BigRedDot n00b
Joined: 29 Oct 2002 Posts: 67 Location: Austin
|
Posted: Sat Feb 01, 2003 10:16 pm Post subject: |
|
|
Quote: | Playing the devils advocate here, how would you respond to the argument that you should be teaching someone the language they're most likely to be using when they're out of school -- the one that employers are looking for.
|
All languages are not created equal, and one important skill is to be able to pick the best tool for a given task at hand. I would speculate that deep exposure the abstract mechanics of problem solving (through programming) leaves one in a better position to evaluate "all those other languages" -- what kinds of problems and solutions they can express well, and what they cannot express easily, and in general how different languages relate and compare to one another. However, there is certainly a pragmatic reason too, if that is all that is required: a one (or even two) semester introduction does not preclude in depth training in other languages later. _________________ Even if you are one-in-a-million, there are still 6000 people just like you. |
|
Back to top |
|
|
masseya Bodhisattva
Joined: 17 Apr 2002 Posts: 2602 Location: Baltimore, MD
|
Posted: Sun Feb 02, 2003 12:29 am Post subject: |
|
|
Let me just say that I think it's a crime that people would pervert the C language and then attempt to teach someone their perversions. If I were an instructor trying to teach a begining computer programming class I would probably use Python since it has clean syntax, can be object oriented, can be used interactively, and has a good amount of performance for a small amount of code. It would certainly suffice for teaching the concepts without being bogged down in syntax. However, I think at some point it's essential to a Computer Science/Computer Engineering department to have an advanced (non-perverted) C class. _________________ if i never try anything, i never learn anything..
if i never take a risk, i stay where i am.. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|