Which book is better for a begainer to study C language?

J

jameskuyper

osmium wrote:
....
... catenate ...

later ... My spell checker refuses to believe there is a word spelled
"cateante". ...

That's good. The important question is, does it believe that there is
a word spelled catenate?
 
L

luserXtrog

gets() is still part of C.  Or did you want more proof?

Bogus.
gets() is part of the library, not the language.
(This distinction is made in Ritchie's C History.)
cm.bell-labs.com/cm/cs/who/dmr/chist.html
 
G

Guest

(e-mail address removed) writes:

And you still haven't set you .sig delimiter properly. Why is posting in
compliant layout so alien to you?

sig delimiter is "-- "

I use google and google buggers up the sig delimiter.
And you've been told *this* before.

I now type "-- "
 
G

Guest

Yes, I saw some of your pseudo code. It was totally unreadable unless
you read python or similar.

I suspect it was scheme (lisp) which looks nothing like python.
If you don't even know what python *looks* like why do you think
you are qualified to post an opinion on it?

<snip>

#
# Echo Client
#

# uses sockets to implement an echo client
# Code lifted from PiaN p436

import sys
import socket

sock =socket.socket (socket.AF_INET, socket.SOCK_STREAM)

if len (sys.argv) < 2 :
host = "localhost"
else:
host = sys.argv [1]

sock.connect ((host, 8881))

print "connected to server"
data = """some data
to test the client
and server"""

for line in data.splitlines ():
sock.sendall (line)
print "sent: ", line
response = sock.recv (8192)
print "received ", response

sock.close()
 
C

Chris Dollin

Richard said:
I dont even understand that. With any language I have used before I
could write my own RE parser if necessary.

Yes -- but you can't write an RE parser /using regular expressions/.
They're not powerful enough.

Lambda-expressions, in contrast, are.
Err, ok <backs off totally confused>

Sorry -- I mean that if you have some Turing-complete implementation
you can program up other Turing-complete implementations more to your
liking, eg with subroutines or data-structures or polymorphic types
or built-in pattern-matching -- anything computable. Of course such
a system will be /slower/ than the underlying engine, and will use
a lot of /space/ (miles and miles of the unbounded but not infinite
Turning-machine tape ...), and their are some picky issues like,
keyboard? what keyboard? and encoding your choice of alphabet, but
/computationally/ once you've built your first Turing machine, you're
done; everything afterwards is mere convenience.
 
E

Eric Sosman

Richard said:
Where is this philosophy written down? I never heard of that.

"Rationale for International Standard--Programming
Languages--C," section 0. First bullet under "Keep the
spirit of C," which is line 17 of page 3 in the April 2003
edition. YPMV.
 
R

Richard Bos

so pretty well *any* reasonable computer language will be TC.
You could almost argue it was the *definition* of a programming
language.

You could, but you'd be wrong. Not by much, though - as Hofstadter notes
in his discussion on ducks, it's hard to write a programming language
that is both Turing-incomplete and interesting, but not impossible.

Richard
 
R

Richard Bos

I use google and google buggers up the sig delimiter.
And you've been told *this* before.

I now type "-- "

_Not_ a sig delimiter. And that is not our problem, but yours. Get a
newsreader.

Richard
 
R

Richard Bos

I suspect it was scheme (lisp) which looks nothing like python.
If you don't even know what python *looks* like why do you think
you are qualified to post an opinion on it?

<snip>

[ Snip more ]
for line in data.splitlines ():
sock.sendall (line)
print "sent: ", line
response =3D sock.recv (8192)
print "received ", response

*Brrrr* And that's why I hate Python. Actually, that's why I hate Python
_even more_. The required indentation is bad enough, but to have
grouping by indentation _and_ a spurious : after the group control
statement is just poor.

Richard
 
K

Keith Thompson

You could, but you'd be wrong. Not by much, though - as Hofstadter notes
in his discussion on ducks, it's hard to write a programming language
that is both Turing-incomplete and interesting, but not impossible.

Doesn't true Turing-completeness require infinite storage?
 
E

Eric Sosman

Keith said:
Doesn't true Turing-completeness require infinite storage?

Yes. Because of the recent worldwide financial reverses,
only a few of the very largest banks can now afford TC systems.
 
K

Keith Thompson

Richard Heathfield said:
Keith Thompson said:


Well, it requires /unbounded/ storage, which may or may not be the
same thing, depending on your definition of "infinite". You don't
need infinite storage in the mathematical sense. You just need
"enough" storage, without knowing in advance how much "enough" is.

And if you have to wait some indeterminately long time to obtain more
storage, that's not a theoretical problem.

In theory, theory and practice are the same. In practice, they
aren't. (I'd credit whoever said that first if I knew who it was.)
 
J

jfbode1029

[email protected] (Richard Bos) said:
(e-mail address removed) wrote:
[ Snip more ]
for line in data.splitlines ():
    sock.sendall (line)
    print "sent: ", line
    response =3D sock.recv (8192)
    print "received ", response
*Brrrr* And that's why I hate Python. Actually, that's why I hate Python
_even more_. The required indentation is bad enough, but to have
grouping by indentation _and_ a spurious : after the group control
statement is just poor.

To despise a language because of the indentation strikes me as rather
silly.

I don't despise it, but I have to admit that I'm uncomfortable with
indentation introducing a new scope; I'd rather have a *visible* token
for that, thank you very much.
Not that I agree with Keighley's ridiculously convoluted "pseudo
code" either.

What, exactly, is so "ridiculously" convoluted about it? Seems like a
pretty straightforward example to me.
 
A

Antoninus Twink

I don't despise it, but I have to admit that I'm uncomfortable with
indentation introducing a new scope; I'd rather have a *visible* token
for that, thank you very much.

Yes... I think it's the message it sends that puts people off. When the
designers of Python made this decision, they must have realized that it
would really, really annoy a lot of people, but they did it anyway,
effectively saying "If you don't like it, **** you!"

So if the designers did something so provocative with a trivial thing
like indentation, it's hardly surprising that people are unwilling to
devote any time to digging far enough into the language to find the
really serious design decisions that would piss them off even more.

Just my $0.02 - silly or not, it's one of the reasons I've never felt
the need to look beyond Perl for my scripting needs.
 
G

Guest

[email protected] (Richard Bos) said:
(e-mail address removed) wrote:
I suspect it was scheme (lisp) which looks nothing like python.
If you don't even know what python *looks* like why do you think
you are qualified to post an opinion on it?
<snip>
[ Snip more ]
for line in data.splitlines ():
    sock.sendall (line)
    print "sent: ", line
    response =3D sock.recv (8192)
    print "received ", response
*Brrrr* And that's why I hate Python. Actually, that's why I hate Python
_even more_. The required indentation is bad enough, but to have
grouping by indentation _and_ a spurious : after the group control
statement is just poor.
Richard
To despise a language because of the indentation strikes me as rather
silly.

I don't despise it, but I have to admit that I'm uncomfortable with
indentation introducing a new scope; I'd rather have a *visible* token
for that, thank you very much.
Not that I agree with Keighley's ridiculously convoluted "pseudo
code" either.

What, exactly, is so "ridiculously" convoluted about it?  Seems like a
pretty straightforward example to me

he's talking about a previous example. He seems to have changed
his mind about python...
 
J

JosephKK

Good to know I'm not alone.

I would not be too sure of that. Backus-Naur Form is Turing complete
is it not? And no possible RE system is not representable in BNF.
I dont even understand that. With any language I have used before I
could write my own RE parser if necessary.
It is an attribute of the language, not one of the parser. I have yet
to meet a language (expressed in a LR script) that i could not write a
LALR(1) parser for. This includes C, C++, BASIC, ALGOL, FORTRAN,
COBOL, Ada, Pascal, FORTH, APL and every assembler i have seen. I
have heard reports that early FORTRAN and COBOL versions were not
Turing Complete, I do not know myself.
 
C

Chris Dollin

JosephKK said:
I would not be too sure of that. Backus-Naur Form is Turing complete
is it not?

BNF is more powerful than REs are. Languages that can match REs aren't
necessarily powerful enough to parse languages expressible in BNF.
And no possible RE system is not representable in BNF.

Assuming that REs are real regular expressions, and not the generalisations
often named REs, that's true; but it doesn't make REs powerful enough.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,103
Latest member
VinaykumarnNevatia
Top