many question on C

M

messier8182

Hello Calcutta,

Buy a bottle of Elmer's glue, and empty it on a chair and sit
down, with your C text book, and do your home work. You lazy "Rosy"
bum.
 
M

Mark McIntyre

note that far is not a C keyword, its some antique intel-specific
extension.
Actually, this is correct. The objects pointed to really do have to
remain < 64K. Only huge pointers allow the target of the pointer to
exceed 64K.

Note that while C only requires a hosted implementation to support 64K
in one object, most implementations support far larger objects.
 
L

LibraryUser

Dave said:
.... snip ...


Yep, though it's bad form unless you're trying to play tricks like
this one (which could be argued to be bad form anyways).

The standard headers define types and macros, and declare functions.
As far as the programmer is concerned (though it need not be implemented
this way), including the header is the same as defining the types and
macros and declaring the functions by hand in your code; some of these
(f'rexample, the type size_t and any function that returns a size_t or
takes one as an argument) depend on knowledge that the programmer doesn't
have (or at least should ignore unless it's absolutely necessary), so
including the header is the only portable way to get them, but since
printf only takes and returns basic types (and it's the only thing from
stdio.h that this program needs) including its definition and leaving
out the rest of <stdio.h> is perfectly valid.

I disagree. For example, printf may be implemented as a macro on
fprintf, and needs to know the definitions of FILE* and stdout.
These come with stdio.h, but not with a raw declaration.

Why use such error prone shortcuts?
 
E

Eric Sosman

LibraryUser said:
I disagree. For example, printf may be implemented as a macro on
fprintf, and needs to know the definitions of FILE* and stdout.
These come with stdio.h, but not with a raw declaration.

<stdio.h> may indeed define a printf() macro to accomplish
the tasks of the printf() function. However, the implementation
must supply an actual function implementation of printf() in
addition to any such macro-ized alternative. Otherwise,

#include <stdio.h>
...
int (*out)(const char*, ...);
out = printf;
out ("Hello, world!\n");

.... would not work, as it must.
Why use such error prone shortcuts?

Agreed: It's silly verging on stupid to write freelance
declarations when the headers exist to do it for you. The
headers are (by the time you get them) immune to typos, while
your own maverick declarations are not. And, as Henry Spencer
points out in "The Ten Commandments for C Programmers," only
the implementation's own headers know the magical incantations
that make the declaration not only correct, but efficient.

I can't begin to tell you how many bugs I've fixed by
getting rid of

extern int errno;
extern char *malloc(int);

.... and the like.
 
K

Keith Thompson

LibraryUser said:
I disagree. For example, printf may be implemented as a macro on
fprintf, and needs to know the definitions of FILE* and stdout.
These come with stdio.h, but not with a raw declaration.

Redeclaring printf(), assuming it's done correctly, is perfectly safe.
Even if the implementation defines it in <stdio.h> as a macro, it must
also be defined as a function; if you want to call the function
directly after including <stdio.h>, you can "#undef" the macro or
enclose the name in parentheses.

This is covered in section 7.1.4 of the standard.
Why use such error prone shortcuts?

In this case, the point is writing deliberately obfuscated code. I
think the idea was that declaring printf() allowed the entire program
source to be on a single line; a "#include <stdio.h>" directive has to
be on a line by itself. In any real application, of course, such
obfuscation is inexcusable; just use the "#include" and move on.
 
K

Kevin Easton

LibraryUser said:
I disagree. For example, printf may be implemented as a macro on
fprintf, and needs to know the definitions of FILE* and stdout.
These come with stdio.h, but not with a raw declaration.

I'm afraid I must here invoke the catchphrase and recommend that you
engage your brain before posting...

If you haven't included stdio.h, and haven't defined one yourself, then
you can't have a macro version of printf. Macros don't come from thin
air (and there *must* be a function version as well, even if there's also
a macro version defined in stdio.h).

- Kevin.
 
R

R. Rajesh Jeba Anbiah

Hello Calcutta,

Buy a bottle of Elmer's glue, and empty it on a chair and sit
down, with your C text book, and do your home work. You lazy "Rosy"
bum.

As the OP is from India, I have to say few words...

You have good resources & so you easily make fun of others. Most of
the Indians suffer from some kind of myths, that's why the OP has
posted the DOS programming questions to CLC. Also, in few places
Internet is quite new; most of the people don't know about
www.google.com or how to Google. Few people also don't know what is
NG; there is also a myth that NG is a place where you can get all
answers; few people don't even know about FAQ.

I am sure, for the people who visit CLC for decades, these kind of
silly questions will be irritating. But, any fun answers that you
provide will make the person so crazy. Hope, you all understand what I
mean....

I wish I could see a Indian expert like Emmanuel Delahaye sometimes
soon in CLC.
 
S

Slartibartfast

R. Rajesh Jeba Anbiah said:
As the OP is from India, I have to say few words...

You have good resources & so you easily make fun of others. Most of
the Indians suffer from some kind of myths, that's why the OP has
posted the DOS programming questions to CLC. Also, in few places
Internet is quite new; most of the people don't know about
www.google.com or how to Google. Few people also don't know what is
NG; there is also a myth that NG is a place where you can get all
answers; few people don't even know about FAQ.

I am sure, for the people who visit CLC for decades, these kind of
silly questions will be irritating. But, any fun answers that you
provide will make the person so crazy. Hope, you all understand what I
mean....

I wish I could see a Indian expert like Emmanuel Delahaye sometimes
soon in CLC.

I'm afraid you're wasting your time on some of this lot.

There are good people here, but there is also a disproportionate number who like nothing better than to indulge in petty point
scoring. Note the amount of effort wasted trawling through my sig, fer chrissakes - a good deal of that analysis was even plain
wrong.

If only people would put that much effort into being helpful. Even a rejection could be phrased respectfully, but the Internet seems
to have attracted huge numbers of dysfunctional types who forget that they're dealing with real people.
 
L

LibraryUser

Slartibartfast said:
I'm afraid you're wasting your time on some of this lot.

There are good people here, but there is also a disproportionate
number who like nothing better than to indulge in petty point
scoring. Note the amount of effort wasted trawling through my
sig, fer chrissakes - a good deal of that analysis was even
plain wrong.

If only people would put that much effort into being helpful.
Even a rejection could be phrased respectfully, but the Internet
seems to have attracted huge numbers of dysfunctional types who
forget that they're dealing with real people.

However it does not seem inappropriate for people to lurk (i.e.
simply read) the newsgroup for a while before jumping in. This
gives them contact with any FAQ and conventions to be observed.
For example, you are posting with excessively long lines (they
should never exceed 79, better 65, chars) and thus causing either
ugly reply formatting or the effort to reformat your words.

Most semi-polite people do not walk up to a conversation and
immediately interject their own thoughts irrespective of the
existing subject.

At the same time there is no excuse for messier8182s rudeness.
 
J

jacob navia

R. Rajesh Jeba Anbiah said:
(e-mail address removed) (messier8182) wrote in message
As the OP is from India, I have to say few words...

You have good resources & so you easily make fun of others. Most of
the Indians suffer from some kind of myths, that's why the OP has
posted the DOS programming questions to CLC.

He is a student in India, trying to get by without doing his/her homework.

This is the same in India or in China or in Chile, and it doesn't actually matter
at all where this student actually is.
Also, in few places
Internet is quite new; most of the people don't know about
www.google.com or how to Google. Few people also don't know what is
NG; there is also a myth that NG is a place where you can get all
answers; few people don't even know about FAQ.

No. This student knew enough to post a message in c.l.c to avoid working for
his/her homework. Indian people are very advanced in Internet using,
they have their own computer hardware/software, some super computers have
been built in India, and I wouldn't say that they are unqualified sorry.
I am sure, for the people who visit CLC for decades, these kind of
silly questions will be irritating. But, any fun answers that you
provide will make the person so crazy. Hope, you all understand what I
mean....

What irritated me was that lack of interest in programming that shows when
instead of trying to learn, lazyiness sets in, and you just post a message to
a newsgroup instead of trying to solve the teacher's questions. I do not mind
students that post asking why they couldn't get this or that to work. That shows
that they are trying to learn not just cutting/pasting the answers from a
newsgroup that should work for them you see?
I wish I could see a Indian expert like Emmanuel Delahaye sometimes
soon in CLC.

I do not doubt that there are expert Indian programmers. Mathematics has
a long tradition in India, and they have bright people. But this ROSY is not
going to get somewhere if he/she doesn't start learning instead of trying
to cheat.

And this is true in India, and anywhere. Students trying to cheat is surely an
international habit, quite independent of nationality!

Let's not mix everything up. Nobody is generalizing from an indian student
that wants to cheat the lesson, to indian programmers, or whatever. Myself
I didn't know where this student came from, neither I cared.

jacob
 
R

R. Rajesh Jeba Anbiah

jacob navia said:
He is a student in India, trying to get by without doing his/her homework.

He may be a enthusiastic student or a professor or a programmer. But,
I'm sure the questions are not homework problems.
No. This student knew enough to post a message in c.l.c to avoid working for
his/her homework.

All the people who know CLC are not smarter; in my experience even
people who post arrogant answers like RTFM or fun answers are not even
experts.
Indian people are very advanced in Internet using,
they have their own computer hardware/software, some super computers have
been built in India,

I guess, you're talking about those elite people who is less than 1%
of total population.
I do not doubt that there are expert Indian programmers. Mathematics has
a long tradition in India, and they have bright people.

That is certainly because of lack of resources. We have resources on
Mathematics that are of 10,000 years old. We have the resources that
say 0!=0 (which most of the non-Indians don't know or accept). But, we
don't have much resources on Computers. I don't know, how would you
learn C, if you don't have a PC or a book...

Well, my intention is not to mess with you or to start another flame
war. My intention was to tell the truth that how such a fun answer
will hurt a humanbeing who lag others purely because of resources.

IOW, you're hunger for a bread; you ask your neighbour. He may tell
you "get it from shop" or "sorry, I don't have it". Instead he tells
you "Yes I have it" and gives you bunch of bullshits; think for a
while, how would you feel....

EOD
 
P

pete

R. Rajesh Jeba Anbiah said:
He may be a enthusiastic student or a professor
or a programmer.
But, I'm sure the questions are not homework problems.

Countless,
is the number of times that I've pondered this point,
while programming:

"To which numbering system can the binary number
1101100100111100 be easily converted to?"
 
S

Slartibartfast

LibraryUser said:
For example, you are posting with excessively long lines (they
should never exceed 79, better 65, chars) and thus causing either
ugly reply formatting or the effort to reformat your words.

The prosecution rests, m'lud.
 
J

John Bode

He may be a enthusiastic student or a professor or a programmer. But,
I'm sure the questions are not homework problems.

Even so, the answers to these questions are easily found in any good C
reference manual, for which this newsgroup is not meant to be a
substitute. This person needs to get into the habit of checking a
reference manual *first*, then doing a Web search, and *then* asking a
question here if he or she didn't find the answer he or she was
looking for.
All the people who know CLC are not smarter; in my experience even
people who post arrogant answers like RTFM or fun answers are not even
experts.

True enough.
I guess, you're talking about those elite people who is less than 1%
of total population.


That is certainly because of lack of resources. We have resources on
Mathematics that are of 10,000 years old. We have the resources that
say 0!=0 (which most of the non-Indians don't know or accept). But, we
don't have much resources on Computers. I don't know, how would you
learn C, if you don't have a PC or a book...

Well, learning how to program in C without a PC available would be
difficult, to say the least. I don't know what the situation is like
in India, but I would think that there would be *some* reference
manuals available.
Well, my intention is not to mess with you or to start another flame
war. My intention was to tell the truth that how such a fun answer
will hurt a humanbeing who lag others purely because of resources.

But we can't know that, can we? For all we know this could be someone
with all the resources in the world available for use, and he or she
just chooses to be lazy. Unless we're told "I don't have a manual and
I can't use the Web", we have to assume they have the basic materials
available.

The truth is, hundreds of students *have* posted to this newsgroup
asking us to do their homework for them, or decided asking here was
simpler than looking it up in their handy reference manual. And it's
because of those people who are lazy and irresponsible that we tend to
be short with anyone asking basic questions.
IOW, you're hunger for a bread; you ask your neighbour. He may tell
you "get it from shop" or "sorry, I don't have it". Instead he tells
you "Yes I have it" and gives you bunch of bullshits; think for a
while, how would you feel....

I was once a clueless newbie, and I got spanked here myself some years
ago. And yet I keep coming back. Funny, that.
 
S

Slartibartfast

Even so, the answers to these questions are easily found in any good C
reference manual, for which this newsgroup is not meant to be a
substitute. This person needs to get into the habit of checking a
reference manual *first*, then doing a Web search, and *then* asking a
question here if he or she didn't find the answer he or she was
looking for.

Very true. But we could at least be civil in the way we tell someone his or
her post was inappropriate, couldn't we??

The truth is, hundreds of students *have* posted to this newsgroup
asking us to do their homework for them, or decided asking here was
simpler than looking it up in their handy reference manual. And it's
because of those people who are lazy and irresponsible that we tend to
be short with anyone asking basic questions.

.....and it's even shorter not to respond at all.
 
C

Chris Dollin

Slartibartfast said:
....and it's even shorter not to respond at all.

But that encourages the idea that it's OK to ask without thinking
first, and we don't want to do that either.
 
R

Richard Heathfield

R. Rajesh Jeba Anbiah said:
He may be a enthusiastic student or a professor or a programmer. But,
I'm sure the questions are not homework problems.

They sure look like homework questions to me. What makes you so sure they're
not?
All the people who know CLC are not smarter;

It is true that many people who use comp.lang.c are not smarter than the
O.P., but - alas - that doesn't stop them from posting here.
in my experience even
people who post arrogant answers like RTFM or fun answers are not even
experts.

I looked through some of your C material at the URL mentioned in your sig
block - <http://guideme.itgo.com/atozofc/> - what you call the "A to Z of
C" Project. I don't think you're in a position to judge who here is an
expert and who is not.
I guess, you're talking about those elite people who is less than 1%
of total population.

Irrelevant. The comp.lang.c newsgroup doesn't really care about your kit.
They do care, however, about your manners. "Do my homework" articles are
considered ill-mannered, and attract hostile replies like syrup attracts
wasps. But "I'm doing my ISO C homework and I got stuck; here's the
question, and here's my best answer so far, but it doesn't work; could you
help?" articles are considered well-mannered and are treated much more
sympathetically.

Well, my intention is not to mess with you or to start another flame
war. My intention was to tell the truth that how such a fun answer
will hurt a humanbeing who lag others purely because of resources.

I don't buy it. The OP was after a free ride.
IOW, you're hunger for a bread; you ask your neighbour. He may tell
you "get it from shop" or "sorry, I don't have it". Instead he tells
you "Yes I have it" and gives you bunch of bullshits; think for a
while, how would you feel....

I guess I would feel hungry, embarrassed at having asked such a stupid
question, and motivated to learn C programming properly and
enthusiastically so that I could get a job and henceforth afford to buy my
own bread.
 
J

John Bode

Slartibartfast said:
Very true. But we could at least be civil in the way we tell someone his or
her post was inappropriate, couldn't we??

I try. Sometimes I fail. Sometimes being civil just doesn't work.
....and it's even shorter not to respond at all.

Which accomplishes what, exactly? Better to confront ignorance up
front and risk some hurt feelings than let that ignorance continue.
I'd rather have you pissed off and thinking for yourself than happy
and spoon fed.
 
R

R. Rajesh Jeba Anbiah

Richard Heathfield said:
They sure look like homework questions to me. What makes you so sure they're
not?

I'm 99.99% sure that this guy's questions are not homework problems.
This guy seems to be more enthusiastic to find the answers for the
questions that he found on some of the Indian based books. I guess, he
is preparing for an interview (his 'c' & 'v' in argc, argv question
sounds so).
I looked through some of your C material at the URL mentioned in your sig
block - <http://guideme.itgo.com/atozofc/> - what you call the "A to Z of
C" Project. I don't think you're in a position to judge who here is an
expert and who is not.

If I understand right, you're personally commenting about my stuff or
you've misunderstood that I'm claiming myself as RJH or you didn't
understand what I said.

<quote>in my experience even people who post arrogant answers like
RTFM or fun answers are not even experts</quote>

This is my experience with NG: once I was too stupid than now and had
more curious questions, I would post the questions. Often I would get
flames and RTFM or RTFFAQ answers. Then, I would reply to that person:
"Well, I have referred the FAQ and I couldn't find any better
solution, that's why I have posted the question"---thinking that
person is expert. But, most of the time, those people would respond
that those guys are even small kids who don't know the answer really.
I think, people prefer to act like an arrogant expert to gain some
sort of appreciation. See, I'm not generalising my opinion.

I don't buy it. The OP was after a free ride.

Sorry I couldn't understand what do you mean here (My first language
is Tamil)
I guess I would feel hungry, embarrassed at having asked such a stupid
question, and motivated to learn C programming properly and
enthusiastically so that I could get a job and henceforth afford to buy my
own bread.

I'm afraid, if you're not affected by "hurts", then obviously you're
not a humanbeing---you must be a god.
 
J

Joona I Palaste

Sorry I couldn't understand what do you mean here (My first language
is Tamil)

Translation:

"I do not believe that is true. What the OP wanted was to have his work
done for him so he would not have to bother actually *thinking* about
C code, when he could just pass ready-written answers without
understanding them himself."

--
/-- Joona Palaste ([email protected]) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"When a man talks dirty to a woman, that's sexual harassment. When a woman talks
dirty to a man, that's 14.99 per minute + local telephone charges!"
- Ruben Stiller
 

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
474,082
Messages
2,570,588
Members
47,209
Latest member
Ingeborg61

Latest Threads

Top