online C programming test

  • Thread starter E. Robert Tisdale
  • Start date
E

E. Robert Tisdale

Does anyone know where I can find a good online C programming test?
I used Google to search for

"C programming test"

and found lots of stuff but the first several pages were disappointing.
 
A

Arthur J. O'Dwyer

Does anyone know where I can find a good online C programming test?

________________
/| /| | | |
||__|| | | REMEMBER NOT |
/ O O\__ | TO FEED THE |
/ \ | TROLLS |
/ \ \|________________|
/ _ \ \ ||
/ |\____\ \ ||
/ | | | |\____/ ||
/ \|_|_|/ | _||
/ / \ |____| ||
/ | | | --|
| | | |____ --|
* _ | |_|_|_| | \-/
*-- _--\ _ \ | ||
/ _ \\ | / `
* / \_ /- | | |
* ___ c_c_c_C/ \C_c_c_c____________
 
V

Vijay Kumar R Zanvar

Arthur J. O'Dwyer said:
________________
/| /| | | |
||__|| | | REMEMBER NOT |
/ O O\__ | TO FEED THE |
/ \ | TROLLS |
/ \ \|________________|
/ _ \ \ ||
/ |\____\ \ ||
/ | | | |\____/ ||
/ \|_|_|/ | _||
/ / \ |____| ||
/ | | | --|
| | | |____ --|
* _ | |_|_|_| | \-/
*-- _--\ _ \ | ||
/ _ \\ | / `
* / \_ /- | | |
* ___ c_c_c_C/ \C_c_c_c____________


Ha-ha-ha!
 
J

Joona I Palaste

Vijay Kumar R Zanvar said:
Vijay Kumar R Zanvar said:
Ha-ha-ha!
Forgot to add. I think by [ERT], in the subject line, you mean [OT].

I thought he meant E. Robert Tisdale. You know, ERT.

--
/-- Joona Palaste ([email protected]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I said 'play as you've never played before', not 'play as IF you've never
played before'!"
- Andy Capp
 
C

CBFalconer

Vijay said:
.... snip ...Forgot to add. I think by [ERT], in the subject line, you mean [OT].

No he doesn't. You obviously have not done the requisite lurking
before posting.
 
P

Peter Nilsson

CBFalconer said:
Vijay said:
... snip ...Forgot to add. I think by [ERT], in the subject line, you mean [OT].

No he doesn't. You obviously have not done the requisite lurking
before posting.

No wonder they say satire is dead... <g>
 
M

Mike Wahler

E. Robert Tisdale said:
Does anyone know where I can find a good online C programming test?

The best one I'm aware of is this newsgroup. The test questions
are those of other posters. If I post code with errors, it gets
quickly torn to shreds -- which is a Good Thing(tm).

The additional benefit is that there are folks here willing to
*explain* what's wrong with poor or broken code.

-Mike
 
R

Richard Heathfield

Mike said:
The best one I'm aware of is this newsgroup. The test questions
are those of other posters.

Mr Tisdale has, of course, already taken that test many times, and failed it
many times.

<snip>
 
E

E. Robert Tisdale

Mike said:
The best one I'm aware of is this newsgroup.
The test questions are those of other posters.
If I post code with errors, it gets quickly torn to shreds --
which is a Good Thing(tm).

The additional benefit is that there are folks here
willing to *explain* what's wrong with poor or broken code.

I agree.
But it would be helpful if someone had collect these examples
into a handy compendium.
 
R

Richard Heathfield

E. Robert Tisdale said:
You can find examples of my C code at

http://www.netwood.net/~edwin/svmtl/

Just click on

The ANSI C Numerical Class Library

I had a quick look. Approximately 6000 lines of code in various .c and .h
files. (3200 when blank lines and comments are removed.)

Most of it wouldn't compile under a conforming C90 implementation, because
of heavy use of the inline keyword, which doesn't exist in C90.

I didn't spend very long reading the code, because I found it to be almost
unreadable. Here's a quick extract, taken entirely at random:

ncl_dcsubmatrix* /* M -= N */
(ncl_dcsubm_msub)(ncl_dcsubmatrix* pM, const ncl_dcsubmatrix* pN) {
ncl_extent mM = ncl_dcsubm_extent2(pM);
ncl_offset i = 0;
#ifdef NCL_ERRANT
ncl_extent mN = ncl_dcsubm_extent2(pN);
if (mM != mN) {
ncl_message("In function ncl_dcsubm_msub(ncl_dcsubmatrix*,\n"
" const ncl_dcsubmatrix*): submatrix differ in second extent.\n");
mM = (mM < mN)? mM: mN;
}
#endif /* NCL_ERRANT */
for (i = 0; i < mM; ++i) {
ncl_dcsubvector v = ncl_dcsubm_subv2(pM, i);
ncl_dcsubvector u = ncl_dcsubm_subv2(pN, i);
ncl_dcsubv_vsub(&v, &u);
ncl_dcsubv_destroy(&u);
ncl_dcsubv_destroy(&v);
}
return pM; }



Frankly, I find that unreadable.


Please remind me where I can find examples of your C programs.

In the literature.
 
E

E. Robert Tisdale

Christian said:
I am impressed.

That anyone would write that kind of code
and willingly publish it where everyone can see it...

And exactly where can we download this code that *you* are so proud of?
 
M

MSG

Richard Heathfield said:
Mr Tisdale has, of course, already taken that test many times, and failed it
many times.

Yes, but others failed it many times as well, sometimes thanks to him,
e.g. when many C people stated that you could not return structs from
functions. I don't want to google, but it went something like this

struct foo f() {
struct foo s;
s.x = x;
s.y = y;
s.z = z;

return s;
}

*Many* (but not ERT) said you could not do this in C. So let's be fair
here.

MSG
 
P

Peter Pichler

Richard Heathfield said:
I didn't spend very long reading the code, because I found it to be almost
unreadable. Here's a quick extract, taken entirely at random:

ncl_dcsubmatrix* /* M -= N */
(ncl_dcsubm_msub)(ncl_dcsubmatrix* pM, const ncl_dcsubmatrix* pN) {
ncl_extent mM = ncl_dcsubm_extent2(pM);
ncl_offset i = 0;
#ifdef NCL_ERRANT
ncl_extent mN = ncl_dcsubm_extent2(pN);
if (mM != mN) {
ncl_message("In function ncl_dcsubm_msub(ncl_dcsubmatrix*,\n"
" const ncl_dcsubmatrix*): submatrix differ in second extent.\n");
mM = (mM < mN)? mM: mN;
}
#endif /* NCL_ERRANT */
for (i = 0; i < mM; ++i) {
ncl_dcsubvector v = ncl_dcsubm_subv2(pM, i);
ncl_dcsubvector u = ncl_dcsubm_subv2(pN, i);
ncl_dcsubv_vsub(&v, &u);
ncl_dcsubv_destroy(&u);
ncl_dcsubv_destroy(&v);
}
return pM; }

Frankly, I find that unreadable.

Not wanting to defend Mr ERT, I must regretfully say that most GPL code I
have seen looks worse. Moreover it is usually highly non-portable. Is there
a clause in GPL that I missed that says that the source must be unreadable?

Peter
 
R

Richard Heathfield

MSG said:
Yes, but others failed it many times as well, sometimes thanks to him,
e.g. when many C people stated that you could not return structs from
functions.

Er, that's bizarre. Of course you can. The Standard even gives an example of
(a pointer to) a function that returns a struct.

Not saying it's a great idea, mind - but you can certainly do it.
I don't want to google, but it went something like this

struct foo f() {
struct foo s;
s.x = x;
s.y = y;
s.z = z;

return s;
}

*Many* (but not ERT) said you could not do this in C.

Do you have a thread reference for that? A message ID or something?
So let's be fair here.

I wasn't aware that I was being unfair. Anyone who says you can't return
structs from functions in C deserves a (metaphorical) slap on the wrist.
That doesn't change what I said about Tisdale, of course.
 
R

Richard Heathfield

Peter Pichler wrote:

I must regretfully say that most GPL code I
have seen looks worse. Moreover it is usually highly non-portable. Is
there a clause in GPL that I missed that says that the source must be
unreadable?

No, but there does seem to be some kind of underlying ethos of "I'm doing
this for free, so I don't have to be legible", which I find appalling. I go
to a lot of trouble to make my own code readable. Whether I succeed is for
others to judge for themselves, but at least I try. I wish this were more
common.
 
D

Default User

MSG said:
struct foo f() {
struct foo s;
s.x = x;
s.y = y;
s.z = z;

return s;
}

*Many* (but not ERT) said you could not do this in C. So let's be fair
here.

I don't believe you when you say "many said you could not do this in C."
I'd like to see you back that up.

Yes,it is true that Trollsdale is not a complete idiot, which makes him
dangerous. He can talk a good game, enough to suck the newbies in.



Brian Rodenborn
 
P

Peter Pichler

MSG said:
Yes, but others failed it many times as well, sometimes thanks to him [ERT],
e.g. when many C people stated that you could not return structs from
functions. I don't want to google, but it went something like this

struct foo f() {
struct foo s;
s.x = x;
s.y = y;
s.z = z;

return s;
}

*Many* (but not ERT) said you could not do this in C. So let's be fair
here.

OK, let's be fair. The code above *is* in fact illegal ;-)
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top