473,382 Members | 1,202 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

help w/ c/c++ problem



28b (macros). write a macro, sizeof(var), that returns the size of
its argument . you are not allowed, to use the sizeof() operator for
this . for extra credit, write another macro, sizeof_t(type), that
returns the size of a type .

given is the following template..........

//////////////////////////////////////////////////////////////////////
// ASS28B.C
//////////////////////////////////////////////////////////////////////

#include <Stdio.H>

#define SIZEOF( var ) // FILL IN MACRO TEXT

void main()
{
char a;
short b;
int c;
long d;
long long e;
struct x* (*f)(struct y*);
union { int a[100]; float b[100]; } g;
void* h;

printf("sizeof a : %i\n", SIZEOF(a));
printf("sizeof b : %i\n", SIZEOF(b));
printf("sizeof c : %i\n", SIZEOF(c));
printf("sizeof d : %i\n", SIZEOF(d));
printf("sizeof e : %i\n", SIZEOF(e));
printf("sizeof f : %i\n", SIZEOF(f));
printf("sizeof g : %i\n", SIZEOF(g));
printf("sizeof h : %i\n", SIZEOF(h));
}

//////////////////////////////////////////////////////////////////////
can u hlp me w/ this ?

tnx !!!
--
mfg, heinrich :)

Jul 1 '07 #1
83 2579
Heinrich Pumpernickel said:
28b (macros). write a macro, sizeof(var), that returns the size of
its argument .
#define SIZEOF(x) (sizeof(x))
you are not allowed, to use the sizeof() operator for this .
Why not? That's what it's *for*.
given is the following template..........
<snip>
>
void main()
If your instructor gave you this template, you need a new instructor. In
C, main returns int.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 1 '07 #2
On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:
28b (macros). write a macro, sizeof(var), that returns the size of
its argument .

#define SIZEOF(x) (sizeof(x))
but i m not allowed to do that
>
you are not allowed, to use the sizeof() operator for this .

Why not? That's what it's *for*.
well its just an excersise
>
given is the following template..........

<snip>
void main()

If your instructor gave you this template, you need a new instructor. In
C, main returns int.
i dont believe that . my c/c++ teacher (very experienced programmer)
AND the book were using both say that if main does not return a
value it can be declared void !
<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
--
mfg, heinrich :)

Jul 1 '07 #3
Heinrich Pumpernickel said:
On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
28b (macros). write a macro, sizeof(var), that returns the size of
its argument .

#define SIZEOF(x) (sizeof(x))

but i m not allowed to do that
>>
you are not allowed, to use the sizeof() operator for this .

Why not? That's what it's *for*.
well its just an excersise
I hope that the point of the exercise is to demonstrate that there is no
satisfactory, portable solution to the problem, other than to change
the rules and allow use of the sizeof operator.

You can just about do it for objects:

#define SIZEOF(x) ((unsigned char *)(&(x)+1)-((unsigned char *)&(x))

but you can't do it for expressions or types without relying on
undefined behaviour, which is never wise if you can avoid it, and here
it can be avoided with ease by using sizeof.
given is the following template..........

<snip>
void main()

If your instructor gave you this template, you need a new instructor.
In C, main returns int.

i dont believe that .
Then find out for yourself, by reading the relevant language definition
specification, ISO/IEC 9899.
my c/c++ teacher (very experienced programmer)
Perhaps he is, but he doesn't know much about C if he can't even get the
entry point right.
AND the book were using both say that if main does not return a
value it can be declared void !
Then get a better book. Better still, get ISO/IEC 9899.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 1 '07 #4
Heinrich Pumpernickel wrote:
On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
>>void main()
If your instructor gave you this template, you need a new instructor. In
C, main returns int.

i dont believe that . my c/c++ teacher (very experienced programmer)
AND the book were using both say that if main does not return a
value it can be declared void !
As it happens, both your teacher and the author of your book are
incompetent. In both C and C++ (there is no such beast as c/c++) main
in a hosted implementation returns an int. Your book should be burnt.
Your "very experienced" teacher is probably protected from burning. It
is time for you to start learning C (or C++) and not what errors your
teacher is "very experienced" in using.
Jul 1 '07 #5
On Jul 1, 8:23 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:


On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:
28b (macros). write a macro, sizeof(var), that returns the size of
its argument .
#define SIZEOF(x) (sizeof(x))
but i m not allowed to do that
you are not allowed, to use the sizeof() operator for this .
Why not? That's what it's *for*.
well its just an excersise

I hope that the point of the exercise is to demonstrate that there is no
satisfactory, portable solution to the problem, other than to change
the rules and allow use of the sizeof operator.

You can just about do it for objects:

#define SIZEOF(x) ((unsigned char *)(&(x)+1)-((unsigned char *)&(x))
#define SIZEOF(x) (&x + 1) -(&x)
It will not work?
Please correct me If I'm wrong.
>
but you can't do it for expressions or types without relying on
undefined behaviour, which is never wise if you can avoid it, and here
it can be avoided with ease by using sizeof.
given is the following template..........
<snip>
void main()
If your instructor gave you this template, you need a new instructor.
In C, main returns int.
i dont believe that .

Then find out for yourself, by reading the relevant language definition
specification, ISO/IEC 9899.
my c/c++ teacher (very experienced programmer)

Perhaps he is, but he doesn't know much about C if he can't even get the
entry point right.
AND the book were using both say that if main does not return a
value it can be declared void !

Then get a better book. Better still, get ISO/IEC 9899.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999- Hide quoted text -

- Show quoted text -

Jul 1 '07 #6
On Jun 30, 8:15 pm, Heinrich Pumpernickel <lan...@linuxmail.org>
wrote:
On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:
given is the following template..........
void main()
If your instructor gave you this template, you need a new instructor. In
C, main returns int.

i dont believe that .
Well, bully for you. Lots of people refuse to believe facts, but that
doesn't alter the facts.
my c/c++ teacher (very experienced programmer)
AND the book were using both say that if main does not return a
value it can be declared void !
Then you need to change your books as well as your teacher. C is well
defined by ISO Standards; it doesn't matter what nonsense is contained
in books which claims to be about C.

Jul 1 '07 #7
deepak wrote:
>>On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
I hope that the point of the exercise is to demonstrate that there is no
satisfactory, portable solution to the problem, other than to change
the rules and allow use of the sizeof operator.

You can just about do it for objects:

#define SIZEOF(x) ((unsigned char *)(&(x)+1)-((unsigned char *)&(x))
#define SIZEOF(x) (&x + 1) -(&x)
It will not work?
Please correct me If I'm wrong.
No. Apart from the fact that your macro would still only work for
objects, as Richard already pointed out, it would also always evaluate
to 1. This is a consequence of the way pointer arithmetics work
(semantically, the subtraction of pointers gives you the number of
objects of the type of x which could fit between those two pointers).
sizeof returns the size of the object in bytes and since 'byte' and
'char' are synonyms in C, subtracting char pointers evaluates to the
number of bytes which could fit between them (in this case, the size of
the object).

--
Denis Kasak
Jul 1 '07 #8
J. J. Farrell wrote, On 01/07/07 07:31:
On Jun 30, 8:15 pm, Heinrich Pumpernickel <lan...@linuxmail.org>
wrote:
>On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
>>Heinrich Pumpernickel said:
given is the following template..........
void main()
If your instructor gave you this template, you need a new instructor. In
C, main returns int.
i dont believe that .

Well, bully for you. Lots of people refuse to believe facts, but that
doesn't alter the facts.
It is understandable the a student would be more inclined to be believe
his teacher and text book than a random collection of people on the
internet.
>my c/c++ teacher (very experienced programmer)
AND the book were using both say that if main does not return a
value it can be declared void !

Then you need to change your books as well as your teacher. C is well
defined by ISO Standards; it doesn't matter what nonsense is contained
in books which claims to be about C.
True. Also checking the relevant section of the comp.lang.c FAQ at
http://c-faq.com specifically http://c-faq.com/ansi/voidmain.html

Note that the further reading page includes a link to a post by
P.J.Plauger who is an author of a book on C, an author of standard C
libraries, and I think was on the committee that standardised C, so he
knows what he speaks of.

You can look at drafts of the C standards yourself, follow this link for
more details http://clc-wiki.net/wiki/c_standard
--
Flash Gordon
Jul 1 '07 #9

"Richard Heathfield" <rj*@see.sig.invalidha scritto nel messaggio news:-8******************************@bt.com...
Heinrich Pumpernickel said:
>On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
>>Heinrich Pumpernickel said:

28b (macros). write a macro, sizeof(var), that returns the size of
its argument .

#define SIZEOF(x) (sizeof(x))

but i m not allowed to do that
>>>
you are not allowed, to use the sizeof() operator for this .

Why not? That's what it's *for*.
well its just an excersise

I hope that the point of the exercise is to demonstrate that there is no
satisfactory, portable solution to the problem, other than to change
the rules and allow use of the sizeof operator.

You can just about do it for objects:

#define SIZEOF(x) ((unsigned char *)(&(x)+1)-((unsigned char *)&(x))
I've tried
#define SIZEOF(x) ((unsigned char*)(&(x)+1)-((unsigned char*)&(x))
#include <stdio.h>
int main(void)
{
register int x = 23;
printf("%d %d\n", (int)sizeof(x), (int)SIZEOF(x));
return 0;
}
on my DS9K, and something very strange happened...
Jul 1 '07 #10

"Heinrich Pumpernickel" <la****@linuxmail.orgha scritto nel messaggio news:11**********************@n2g2000hse.googlegro ups.com...
On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
void main()

If your instructor gave you this template, you need a new instructor. In
C, main returns int.

i dont believe that . my c/c++ teacher (very experienced programmer)
AND the book were using both say that if main does not return a
value it can be declared void !
Both your C/C++ teacher (is he actually teaching you both two
languages?) and the book you're using are wrong.
Jul 1 '07 #11
Army1987 said:
>
"Richard Heathfield" <rj*@see.sig.invalidha scritto nel messaggio
news:-8******************************@bt.com...
>Heinrich Pumpernickel said:
>>On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:

28b (macros). write a macro, sizeof(var), that returns the size
of its argument .

#define SIZEOF(x) (sizeof(x))

but i m not allowed to do that
you are not allowed, to use the sizeof() operator for this .

Why not? That's what it's *for*.

well its just an excersise

I hope that the point of the exercise is to demonstrate that there is
no satisfactory, portable solution to the problem, other than to
change the rules and allow use of the sizeof operator.

You can just about do it for objects:

#define SIZEOF(x) ((unsigned char *)(&(x)+1)-((unsigned char *)&(x))

I've tried
#define SIZEOF(x) ((unsigned char*)(&(x)+1)-((unsigned char*)&(x))
#include <stdio.h>
int main(void)
{
register int x = 23;
printf("%d %d\n", (int)sizeof(x), (int)SIZEOF(x));
return 0;
}
on my DS9K, and something very strange happened...
Yes, because you can't take the address of a register. I deduce (from
the fact that you posted at all) that you survived the experience - or
did your machine post the article on your behalf, posthumously?

Anyway, your point is valid - register objects are Yet Another Reason
Not To Do This Very Silly Thing.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 1 '07 #12

"Richard Heathfield" <rj*@see.sig.invalidha scritto nel messaggio news:P-******************************@bt.com...
Army1987 said:
>I've tried
#define SIZEOF(x) ((unsigned char*)(&(x)+1)-((unsigned char*)&(x))
#include <stdio.h>
int main(void)
{
register int x = 23;
printf("%d %d\n", (int)sizeof(x), (int)SIZEOF(x));
return 0;
}
on my DS9K, and something very strange happened...

Yes, because you can't take the address of a register. I deduce (from
the fact that you posted at all) that you survived the experience - or
did your machine post the article on your behalf, posthumously?

Anyway, your point is valid - register objects are Yet Another Reason
Not To Do This Very Silly Thing.
To be honest, the DS9K was actually MSVC, and the "something very
strange" was that it didn't compile. (The requirement for the
operand of & not to be register is a constraint.)

But I'm thinking of replacing it with:
#include <stdio.h>
#define SIZEOF(x) ((unsigned char*)(&(x)+1)-((unsigned char*)&(x))
int main(void)
{
int x = 23;
int *p = &x;
printf("%d\n", (int)SIZEOF(*p++));
return 0;
}
and running it on a DS9K. But I'm too afraid to do that.
Jul 1 '07 #13
Heinrich Pumpernickel wrote:
<r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
.... snip ...
>>
>>void main()

If your instructor gave you this template, you need a new
instructor. In C, main returns int.

i dont believe that . my c/c++ teacher (very experienced
programmer) AND the book were using both say that if main does
not return a value it can be declared void !
Then both the book AND your instructor are wrong, and both need
replacing.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jul 1 '07 #14

"Heinrich Pumpernickel" <la****@linuxmail.orgha scritto nel messaggio
news:11**********************@c77g2000hse.googlegr oups.com...
>

28b (macros). write a macro, sizeof(var), that returns the size of
its argument . you are not allowed, to use the sizeof() operator for
this .
#define SIZEOF( var ) sizeof var
Note that I used sizeof, without parentheses, not sizeof().
for extra credit, write another macro, sizeof_t(type), that
returns the size of a type .
Does the requirement for the previous point also apply to this one?
If so, the latter point is impossible. If not, try:
#define sizeof_t sizeof
Jul 1 '07 #15
Army1987 wrote:
>
.... snip ...
>
I've tried
#define SIZEOF(x) ((unsigned char*)(&(x)+1)-((unsigned char*)&(x))
#include <stdio.h>
int main(void)
{
register int x = 23;
printf("%d %d\n", (int)sizeof(x), (int)SIZEOF(x));
return 0;
}
on my DS9K, and something very strange happened...
Doesn't need a DS9K. Taking the address of a register variable is
illegal.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jul 1 '07 #16

"CBFalconer" <cb********@yahoo.comha scritto nel messaggio news:46***************@yahoo.com...
Army1987 wrote:
>>
... snip ...
>>
I've tried
#define SIZEOF(x) ((unsigned char*)(&(x)+1)-((unsigned char*)&(x))
#include <stdio.h>
int main(void)
{
register int x = 23;
printf("%d %d\n", (int)sizeof(x), (int)SIZEOF(x));
return 0;
}
on my DS9K, and something very strange happened...

Doesn't need a DS9K. Taking the address of a register variable is
illegal.
If it wasn't illegal, nothing strange would happen even on a DS9K,
since the DS9K is a conforming hosted implementation.
Jul 1 '07 #17
On Sat, 30 Jun 2007 20:15:03 -0700, in comp.lang.c , Heinrich
Pumpernickel <la****@linuxmail.orgwrote:
>On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
well its just an excersise
OK, but in that case I suggest you write your best effort at solving
the problem, post it here, and ask for assistance. You could also
google for it.
>If your instructor gave you this template, you need a new instructor. In
C, main returns int.
i dont believe that . my c/c++ teacher (very experienced programmer)
AND the book were using both say that if main does not return a
value it can be declared void !
Then I'm afraid that both your book and your teacher are wrong. The C
Standard REQUIRES main to return an int. Whether you want to return
something or not, you need to at least return 0. Otherwise you are
breaking the rules of C.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 1 '07 #18
Mark McIntyre wrote:
Then I'm afraid that both your book and your teacher are wrong. The C
Standard REQUIRES main to return an int.
This is incorrect. The C standard requires implementations to accept main
returning int, but does not prohibit other return types either from being
allowed by implementations or from being used by programs.
Jul 1 '07 #19
Harald van D?k said:
Mark McIntyre wrote:
>Then I'm afraid that both your book and your teacher are wrong. The C
Standard REQUIRES main to return an int.

This is incorrect. The C standard requires implementations to accept
main returning int, but does not prohibit other return types either
from being allowed by implementations or from being used by programs.
True enough, but neither does it define the behaviour of such program.
The C Standard does not forbid implementations from accepting Fortran
programs, either. That doesn't mean that Fortran programs are correct C
programs.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 1 '07 #20
On Jul 1, 12:55 am, Flash Gordon <s...@flash-gordon.me.ukwrote:
J. J. Farrell wrote, On 01/07/07 07:31:
On Jun 30, 8:15 pm, Heinrich Pumpernickel <lan...@linuxmail.org>
wrote:
On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
given is the following template..........
void main()
If your instructor gave you this template, you need a new instructor. In
C, main returns int.
i dont believe that .
Well, bully for you. Lots of people refuse to believe facts, but that
doesn't alter the facts.

It is understandable the a student would be more inclined to be believe
his teacher and text book than a random collection of people on the
internet.
True, but I'd expect someone intelligent enough to become a programmer
would also do some research on who he's getting advice from. It takes
only a few seconds to discover that while Richard may not be an
embodiment of the Standard, and is not infallible, he does have a
clue. The OP also ought to be able to see that the group FAQ is pretty
accurate, and since he of course read that before posting here ...

Jul 1 '07 #21
Army1987 wrote:
"Heinrich Pumpernickel" <la****@linuxmail.orgha scritto nel messaggio
news:11**********************@c77g2000hse.googlegr oups.com...
>>
28b (macros). write a macro, sizeof(var), that returns the size of
its argument . you are not allowed, to use the sizeof() operator for
this .

#define SIZEOF( var ) sizeof var
Note that I used sizeof, without parentheses, not sizeof().
While I understand why you implied that parenthesis are unnecessary,
this is incorrect in this case. What would happen if someone wrote
SIZEOF(var)+1 further in the code?

--
Denis Kasak
Jul 1 '07 #22
Denis Kasak wrote:
Army1987 wrote:
>"Heinrich Pumpernickel" <la****@linuxmail.orgha scritto nel messaggio
news:11**********************@c77g2000hse.googleg roups.com...
>>>
28b (macros). write a macro, sizeof(var), that returns the size of
its argument . you are not allowed, to use the sizeof() operator for
this .

#define SIZEOF( var ) sizeof var
Note that I used sizeof, without parentheses, not sizeof().

While I understand why you implied that parenthesis are unnecessary,
this is incorrect in this case. What would happen if someone wrote
SIZEOF(var)+1 further in the code?
That can be avoided by

#define SIZEOF( var ) (sizeof var)
Jul 1 '07 #23
On Jul 2, 6:34 am, Harald van D k <true...@gmail.comwrote:
Denis Kasak wrote:
Army1987 wrote:
#define SIZEOF( var ) sizeof var
Note that I used sizeof, without parentheses, not sizeof().
While I understand why you implied that parenthesis are unnecessary,
this is incorrect in this case. What would happen if someone wrote
SIZEOF(var)+1 further in the code?

That can be avoided by

#define SIZEOF( var ) (sizeof var)
Huh? sizeof binds more tightly than addition anyway.
sizeof var + 1 == (sizeof var) + 1. The problem would
occur if someone wrote:
SIZEOF(var+1)
so the macro needs to be:
#define SIZEOF( var ) (sizeof (var))

(The outer brackets might be superfluous but I'm not
sure, so it doesn't hurt to have them there).

Jul 1 '07 #24
In article <f6**********@tdi.cu.mi.it>, Army1987 <pl********@for.itwrote:
>
"CBFalconer" <cb********@yahoo.comha scritto nel messaggio
news:46***************@yahoo.com...
>Army1987 wrote:
>>>
... snip ...
>>>
I've tried
#define SIZEOF(x) ((unsigned char*)(&(x)+1)-((unsigned char*)&(x))
#include <stdio.h>
int main(void)
{
register int x = 23;
printf("%d %d\n", (int)sizeof(x), (int)SIZEOF(x));
return 0;
}
on my DS9K, and something very strange happened...

Doesn't need a DS9K. Taking the address of a register variable is
illegal.

If it wasn't illegal, nothing strange would happen even on a DS9K,
since the DS9K is a conforming hosted implementation.
It's a constraint violation, which means the DS9k will warn you BEFORE
you try to run it that you probably don't want to.

Last I checked, the DS9k's diagnostics were, if not good, at least
non-fatal.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
I thought it might be a syntax error (given that a keyword is being used in the
wrong place), but every time I say "syntax error" in this newsgroup I get
jumped on by half a dozen people with sharp teeth. --Richard Heathfield in CLC
Jul 2 '07 #25
Old Wolf wrote:
On Jul 2, 6:34 am, Harald van D k <true...@gmail.comwrote:
>Denis Kasak wrote:
Army1987 wrote:
>#define SIZEOF( var ) sizeof var
Note that I used sizeof, without parentheses, not sizeof().
While I understand why you implied that parenthesis are unnecessary,
this is incorrect in this case. What would happen if someone wrote
SIZEOF(var)+1 further in the code?

That can be avoided by

#define SIZEOF( var ) (sizeof var)

Huh? sizeof binds more tightly than addition anyway.
You're right, I missed that. And it doesn't (or shouldn't) really matter
that incorrect code such as SIZEOF(p)->mem is accepted.
Jul 2 '07 #26
On Sun, 01 Jul 2007 18:52:52 +0200, in comp.lang.c , Harald van D?k
<tr*****@gmail.comwrote:
>Mark McIntyre wrote:
>Then I'm afraid that both your book and your teacher are wrong. The C
Standard REQUIRES main to return an int.

This is incorrect.
I should have added "for a hosted implementation".
>The C standard requires implementations to accept main
returning int, but does not prohibit other return types either from being
allowed by implementations or from being used by programs.
This has been done to death. For a hosted implementation, your
statement is incorrect if you want to be compliant to the standard.

There's of course nothing stopping your implementation returning
whatever it likes, including all your post marked "undeliverable".
However it would then not be a C compiler.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 2 '07 #27
Harald van Dijk <tr*****@gmail.comwrites:
[...]
So it's not even possible to claim that 5.1.2.2.3 has accidentally been
misworded. It is worded the way it is specifically because main /is/
allowed to return other types than int.
To be painfully clear, main is allowed to return other types than int
only if the implementation specifically allows it.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 3 '07 #28
Keith Thompson wrote:
Harald van Dijk <tr*****@gmail.comwrites:
[...]
>So it's not even possible to claim that 5.1.2.2.3 has accidentally been
misworded. It is worded the way it is specifically because main /is/
allowed to return other types than int.

To be painfully clear, main is allowed to return other types than int
only if the implementation specifically allows it.
"It is worded the way it is specifically because the "implementation-defined
manner" of 5.1.2.2.1 does extend to alternate return types."

Do you think that is that clear enough?
Jul 3 '07 #29
Harald van Dijk <tr*****@gmail.comwrites:
Keith Thompson wrote:
>Harald van Dijk <tr*****@gmail.comwrites:
[...]
>>So it's not even possible to claim that 5.1.2.2.3 has accidentally been
misworded. It is worded the way it is specifically because main /is/
allowed to return other types than int.

To be painfully clear, main is allowed to return other types than int
only if the implementation specifically allows it.

"It is worded the way it is specifically because the "implementation-defined
manner" of 5.1.2.2.1 does extend to alternate return types."

Do you think that is that clear enough?
Sure.

My point was that your quoted paragraph, starting with "So it's not
even possible", could be misinterpreted to imply that void main(void)
is allowed in general. I know you didn't mean it that way, I was just
trying to forestall a possible misunderstanding. 5.1.2.2.1p1 grants
flexibility to implementations, not (directly) to programs.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 3 '07 #30
Keith Thompson said:
Richard Heathfield <rj*@see.sig.invalidwrites:
>Keith Thompson said:
<snip>
>>Why are you ignoring that explicit statement in the standard?

Perhaps because he realises how utterly weaselish and useless it is.

Nevertheless, it's part of the standard.
I agree, of course. Nevertheless, it's utterly weaselish and useless.
"void main(void)" is ugly and its mother dresses it funny, and I've
never claimed otherwise.
I know.
I simply take issue with Mark's statement upthread:

| Then I'm afraid that both your book and your teacher are wrong. The
| C Standard REQUIRES main to return an int.

That statement is just incorrect. I don't particularly expect Mark
ever to admit this, so I'll gladly drop this now.
Fine by me. Arguing with Mr McIntyre seems to be a waste of time[1], and
I have stopped bothering.

[1] Except that it has educational value for newbies, of course. But
other people can do that just as well as I can, and probably with a
better temper, too.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 3 '07 #31
CBFalconer said:

<snip>
Once implementation defined the action
is beyond the reach of the standard, and thus off-topic here. The
system is non-portable.
If that were the case, then the following program would be off-topic:

#include <stdio.h>
#include <limits.h>

int main(void)
{
printf("%d\n", INT_MAX);
return 0;
}

Is it, then, your contention that the above program is off-topic in
comp.lang.c?

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 3 '07 #32
Richard Heathfield wrote:
CBFalconer said:

<snip>
>Once implementation defined the action
is beyond the reach of the standard, and thus off-topic here. The
system is non-portable.

If that were the case, then the following program would be off-topic:

#include <stdio.h>
#include <limits.h>

int main(void)
{
printf("%d\n", INT_MAX);
return 0;
}

Is it, then, your contention that the above program is off-topic in
comp.lang.c?
No. The action is defined. The actual output may vary. Similarly
something that times the interval between two keystrokes.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jul 3 '07 #33
On Jul 1, 5:23 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:
On Jul 1, 5:04 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:
given is the following template..........

<snip>

void main()

If your instructor gave you this template, you need a new instructor.
In C, main returns int.
i dont believe that .

Then find out for yourself, by reading the relevant language definition
specification, ISO/IEC 9899.
my c/c++ teacher (very experienced programmer)

Perhaps he is, but he doesn't know much about C if he can't even get the
entry point right.
but he's a doctor
AND the book were using both say that if main does not return a
value it can be declared void !

Then get a better book.
its not just some book, its called "C: The Complete Reference",
written by some famous and internationally renowed autor
("...world's leading programming author...", "...is a leading
authority on C and was a member of the ANSI/ISO committee that
standardized C...") and it spicifically says..........

You may also declare main() as void if it does not
return a value.
Better still, get ISO/IEC 9899.
our lib has copies of "The Annotated C Standard" that says
its ISO 9899:1990 on it, and it spicifically says..........

You are therefore free to declare main() as required
by your program.

next is an example of void main(void) .
--
mfg, heinrich :)


Jul 4 '07 #34
In article <11*********************@k29g2000hsd.googlegroups. com>,
Heinrich Pumpernickel <la****@linuxmail.orgwrote:
>On Jul 1, 5:23 am, Richard Heathfield <r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
my c/c++ teacher (very experienced programmer)

Perhaps he is, but he doesn't know much about C if he can't even get the
entry point right.

but he's a doctor
That is far from being a reliable indicator of knowledge about C.
(Some would claim it's inversely correlated; I wouldn't go quite that far,
but I wouldn't argue too hard against it either.)

AND the book were using both say that if main does not return a
value it can be declared void !

Then get a better book.

its not just some book, its called "C: The Complete Reference",
written by some famous and internationally renowed autor
("...world's leading programming author...", "...is a leading
authority on C and was a member of the ANSI/ISO committee that
standardized C...") and it spicifically says..........

You may also declare main() as void if it does not
return a value.
I recommend you take a look at
<http://www.plethora.net/~seebs/c/c_tcr.htmland
<http://www.lysator.liu.se/c/schildt.htmlbefore you take seriously
anything you've learned in this course.

>Better still, get ISO/IEC 9899.

our lib has copies of "The Annotated C Standard" that says
its ISO 9899:1990 on it, and it spicifically says..........

You are therefore free to declare main() as required
by your program.

next is an example of void main(void) .
If you read the standard as well as the annotations, you may realize
that the text of the standard on the page facing this example states
that this example is utter bullschildt.

It's also worth noting that the difference in price between this book
and a copy of ISO 9899:1990 (when it was available) reflects the value
of the annotations quite well.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
[i]n attacks on "liberals", he's been known to accuse them of just taking the
Bible at face value without studying it. Now, there are a lot of problems with
some liberal belief systems... But that's not generally one of them. --seebs
Jul 4 '07 #35
Heinrich Pumpernickel said:
On Jul 1, 5:23 am, Richard Heathfield <r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
<snip>
my c/c++ teacher (very experienced programmer)

Perhaps he is, but he doesn't know much about C if he can't even get
the entry point right.

but he's a doctor
So? Doctors can be stupid too.
AND the book were using both say that if main does not return a
value it can be declared void !

Then get a better book.

its not just some book, its called "C: The Complete Reference",
Oh, I see. In that case, getting a better book isn't enough. You'll
actually need to burn the book you already have. I'm not usually a fan
of book-burning, but in this case it's justified.

By the way, it's now my opinion that you're trolling. If you're actually
serious, I suggest you take a look at the views of a couple of genuine
ISO C Committee members on Schildt's writings:

http://herd.plethora.net/~seebs/c/c_tcr.html - by Peter Seebach, ISO C
Committee

http://www.lysator.liu.se/c/schildt.html - by Clive Feather, ISO C
Committee

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 4 '07 #36
Dave Vandervies wrote, On 04/07/07 03:39:
In article <11*********************@k29g2000hsd.googlegroups. com>,
Heinrich Pumpernickel <la****@linuxmail.orgwrote:
>On Jul 1, 5:23 am, Richard Heathfield <r...@see.sig.invalidwrote:
>>Heinrich Pumpernickel said:
>>>my c/c++ teacher (very experienced programmer)
Perhaps he is, but he doesn't know much about C if he can't even get the
entry point right.
but he's a doctor

That is far from being a reliable indicator of knowledge about C.
(Some would claim it's inversely correlated; I wouldn't go quite that far,
but I wouldn't argue too hard against it either.)
Depends on what he is a doctor in and how good a doctor he is. An
excelent medical doctor might make a very good C programmer as s/he
would be used to taking a lot of care to get things right.
>>>AND the book were using both say that if main does not return a
value it can be declared void !
Then get a better book.
its not just some book, its called "C: The Complete Reference",
written by some famous and internationally renowed autor
("...world's leading programming author...", "...is a leading
authority on C and was a member of the ANSI/ISO committee that
standardized C...") and it spicifically says..........

You may also declare main() as void if it does not
return a value.

I recommend you take a look at
<http://www.plethora.net/~seebs/c/c_tcr.htmland
<http://www.lysator.liu.se/c/schildt.htmlbefore you take seriously
anything you've learned in this course.
Also search this group for the authors name and for bullshildt.
>>Better still, get ISO/IEC 9899.
our lib has copies of "The Annotated C Standard" that says
its ISO 9899:1990 on it, and it spicifically says..........

You are therefore free to declare main() as required
by your program.

next is an example of void main(void) .

If you read the standard as well as the annotations, you may realize
that the text of the standard on the page facing this example states
that this example is utter bullschildt.

It's also worth noting that the difference in price between this book
and a copy of ISO 9899:1990 (when it was available) reflects the value
of the annotations quite well.
To understand this true comment you need to know that the book cost a
*lot* less than buying a copy of the standard. Thus the comment is
saying that the annotations have negative value. From everything I have
seen this is true.
--
Flash Gordon
Jul 4 '07 #37
Richard Heathfield <rj*@see.sig.invalidwrites:
Keith Thompson said:
<snip>
>>
[Chuck] wrote that "the system is non-portable". The word "system"
usually refers to implementations;

It does? I have never thought of "the system" as being an
implementation. I generally use the word either to refer to the host
environment (which may not even have an implementation installed on
it), or to a collection of programs I am writing that, together, do a
well-defined job.
[...]

Oh, well. I was trying to come up with a reasonable interpretation of
his statement that "the system is non-portable". The "collection of
programs" meaning is reasonable, but we weren't talking about more
than program.

I'll let Chuck clarify if he wants to.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 4 '07 #38
Keith Thompson wrote:
Richard Heathfield <rj*@see.sig.invalidwrites:
>Keith Thompson said:
<snip>
>>>
[Chuck] wrote that "the system is non-portable". The word "system"
usually refers to implementations;

It does? I have never thought of "the system" as being an
implementation. I generally use the word either to refer to the host
environment (which may not even have an implementation installed on
it), or to a collection of programs I am writing that, together, do a
well-defined job.
[...]

Oh, well. I was trying to come up with a reasonable interpretation of
his statement that "the system is non-portable". The "collection of
programs" meaning is reasonable, but we weren't talking about more
than program.

I'll let Chuck clarify if he wants to.
All I meant is that you can't cart the source to an arbitrary
machine/compiler, press the appropriate half dozen or so buttons,
and walk away with a functional program.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net
--
Posted via a free Usenet account from http://www.teranews.com

Jul 4 '07 #39
In article <dv*********************@bt.com>,
Richard Heathfield <rj*@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
>On Jul 1, 5:23 am, Richard Heathfield <r...@see.sig.invalidwrote:
>>Then get a better book.

its not just some book, its called "C: The Complete Reference",

Oh, I see. In that case, getting a better book isn't enough. You'll
actually need to burn the book you already have. I'm not usually a fan
of book-burning, but in this case it's justified.

By the way, it's now my opinion that you're trolling. If you're actually
serious, I suggest you take a look at the views of a couple of genuine
ISO C Committee members on Schildt's writings:
I think you're a little bit hasty in deciding that he's trolling (though
perhaps only a little bit). If he's going by what's printed on the
back cover of his textbook and hasn't been exposed to more... unbiased,
shall we say... descriptions of the book and its author, Hanlon's Razor
certainly would apply here.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
And bears would make good riding buddies. Leave 'em outside at the bike rack,
forget about the nasty dogs and their obnoxious owners, [...]
--Zoot Katz in rec.bicycles.misc
Jul 4 '07 #40
CBFalconer <cb********@yahoo.comwrites:
Keith Thompson wrote:
>Richard Heathfield <rj*@see.sig.invalidwrites:
>>Keith Thompson said:
<snip>

[Chuck] wrote that "the system is non-portable". The word "system"
usually refers to implementations;

It does? I have never thought of "the system" as being an
implementation. I generally use the word either to refer to the host
environment (which may not even have an implementation installed on
it), or to a collection of programs I am writing that, together, do a
well-defined job.
[...]

Oh, well. I was trying to come up with a reasonable interpretation of
his statement that "the system is non-portable". The "collection of
programs" meaning is reasonable, but we weren't talking about more
than program.

I'll let Chuck clarify if he wants to.

All I meant is that you can't cart the source to an arbitrary
machine/compiler, press the appropriate half dozen or so buttons,
and walk away with a functional program.
Ok, Your odd choice of words ("the system is non-portable" rather than
"the program is non-portable") threw me off.

I agree, of course, that the program is non-portable.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 4 '07 #41
On Jul 3, 11:36 pm, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:
On Jul 1, 5:23 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:

<snip>
my c/c++ teacher (very experienced programmer)
Perhaps he is, but he doesn't know much about C if he can't even get
the entry point right.
but he's a doctor

So? Doctors can be stupid too.
AND the book were using both say that if main does not return a
value it can be declared void !
Then get a better book.
its not just some book, its called "C: The Complete Reference",

Oh, I see. In that case, getting a better book isn't enough. You'll
actually need to burn the book you already have. I'm not usually a fan
of book-burning, but in this case it's justified.

By the way, it's now my opinion that you're trolling.
Possible, but I suspect he's just young and naive. The assumption that
being a doctor means someone is an expert on C sounds like a person
who hasn't yet had to clean up after incompetent doctor coders. Which
is not to say that there are no doctors who are competent at C of
course - quite the opposite. There's probably much the same ratio of
competence to incompetence among C programmers who are doctors and C
programmers who are not. The nature of the incompetence differs
though ...

Jul 4 '07 #42

"J. J. Farrell" <jj*@bcs.org.ukha scritto nel messaggio news:11**********************@e16g2000pri.googlegr oups.com...
On Jul 3, 11:36 pm, Richard Heathfield <r...@see.sig.invalidwrote:
>Heinrich Pumpernickel said:
On Jul 1, 5:23 am, Richard Heathfield <r...@see.sig.invalidwrote:
Heinrich Pumpernickel said:

<snip>
my c/c++ teacher (very experienced programmer)
>Perhaps he is, but he doesn't know much about C if he can't even get
the entry point right.
but he's a doctor

So? Doctors can be stupid too.
AND the book were using both say that if main does not return a
value it can be declared void !
>Then get a better book.
its not just some book, its called "C: The Complete Reference",

Oh, I see. In that case, getting a better book isn't enough. You'll
actually need to burn the book you already have. I'm not usually a fan
of book-burning, but in this case it's justified.

By the way, it's now my opinion that you're trolling.

Possible, but I suspect he's just young and naive. The assumption that
I'd expect a young and naive but non-stupid person to be more
likely not to believe their teacher when he's right than viceversa.
(It also depends on the teacher. If he is *really* expert in
programming C on implementations where void main() is allowed and
just happened not to care about standard C, all right, as long as
he claims to teach "FooWare C 7.4", rather than just "C". On the
other hand, an instructor like mine, who compared strings with ==,
never once checked the result of malloc() or of scanf(), used
printf("%d", sizeof(MyStruct)) and showed us how unsurprisingly the
size was the sum of the sizes of the fields of the structure etc.
couldn't be taken seriously, no matter how hard I tried.)
being a doctor means someone is an expert on C sounds like a person
who hasn't yet had to clean up after incompetent doctor coders. Which
is not to say that there are no doctors who are competent at C of
course - quite the opposite. There's probably much the same ratio of
competence to incompetence among C programmers who are doctors and C
programmers who are not. The nature of the incompetence differs
though ...

Jul 5 '07 #43
On Mon, 02 Jul 2007 23:34:32 -0700, in comp.lang.c , Keith Thompson
<ks***@mib.orgwrote:
>
"void main(void)" is ugly and its mother dresses it funny, and I've
never claimed otherwise. I simply take issue with Mark's statement
upthread:

| Then I'm afraid that both your book and your teacher are wrong. The C
| Standard REQUIRES main to return an int.

That statement is just incorrect. I don't particularly expect Mark
ever to admit this, so I'll gladly drop this now.
I'll admit to it when the persons who spent several hundred posts
convincing *me* of it four years ago in this very forum, admits they
were wrong. Dan, where are you now?
:-)
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 5 '07 #44
On Tue, 03 Jul 2007 08:06:35 +0000, in comp.lang.c , Richard
Heathfield <rj*@see.sig.invalidwrote:
>Fine by me. Arguing with Mr McIntyre seems to be a waste of time[1], and
I have stopped bothering.
When you stoop to stupid insults ike this, you merely demonstrate why
people increasingly argue with you. FWIW I frequently do agree with
you, but naturally only when you're right....
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 5 '07 #45
On Tue, 03 Jul 2007 02:17:32 +0200, in comp.lang.c , Harald van D?k
<tr*****@gmail.comwrote:

(snip)
>Change 5.1.2.2.3p1 to:

If the return type of the /main/ function is a type compatible with
/int/, then a return from the initial call to the /main/ function is
equivalent to calling the /exit/ function with the value returned by =20
the /main/ function as its argument.[10] If the } that terminates the
/main/ function is reached,
(spaced for emphasis)
>or the return type of the /main/ function is
not a type compatible with /int/, the termination status returned =20
to the host environment is unspecified.
Excellent - thats interesting and thanks for pointing it out to me. I
quite agree it clarifies that a hosted env to provide an
implementation defined non-int return type. This is evidently a change
from C89, and as such is a welcome clarification.

So I agree with you, a hosted implementation can define a non-int
return type for main. However I stress, it is implementation defined,
non standardised and nonportable. As such I stand by my original
comment.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 5 '07 #46
"Army1987" writes:

<snippage, WRT instructors>
... just happened not to care about standard C, all right, as long as
he claims to teach "FooWare C 7.4", rather than just "C".
The problem is that the student was told this in the first session of the
class buried in a blur of boilerplate information, "My name is, my office is
at, my office hours are, my telephone extension is, the subject is... " IOW,
it is buried in noise.

If the student reads the preface of his text book _carefully_ he may get a
heads up there. The bottom line: I would guess that most students don't
even _know_ what they are learning. And my guess is that damned few
instructors have anywhere near the passion that most of the regulars on this
newsgroup has for standards. Remarkably, many regulars actually seem to
_enjoy_ it. A three gotcha day is a highlight and a day to be remembered.
Jul 5 '07 #47
Mark McIntyre wrote:
Richard Heathfield <rj*@see.sig.invalidwrote:
>Fine by me. Arguing with Mr McIntyre seems to be a waste of
time[1], and I have stopped bothering.

When you stoop to stupid insults ike this, you merely demonstrate
why people increasingly argue with you. FWIW I frequently do agree
with you, but naturally only when you're right....
However, you seem to fail to apply that criterion when you are
wrong. :-)

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jul 5 '07 #48
On Thu, 05 Jul 2007 11:41:56 -0400, in comp.lang.c , CBFalconer
<cb********@yahoo.comwrote:
>Mark McIntyre wrote:
>Richard Heathfield <rj*@see.sig.invalidwrote:
>>Fine by me. Arguing with Mr McIntyre seems to be a waste of
time[1], and I have stopped bothering.

When you stoop to stupid insults ike this, you merely demonstrate
why people increasingly argue with you. FWIW I frequently do agree
with you, but naturally only when you're right....

However, you seem to fail to apply that criterion when you are
wrong. :-)
I can read this one of two ways:

0) I don't agree with someone when I'm wrong. This is false - unless
I'm not convinced by the other guy's arguments. If the argument is
convincing I'll happily concede (see elsethread for an example).

1) I don't agree with someone when /he's/ wrong. This is true as often
as I can make it so... :-)

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 5 '07 #49
On Thu, 05 Jul 2007 06:42:42 -0700, osmium wrote:
If the student reads the preface of his text book _carefully_ he may get a
heads up there.
[snip]
The preface of my textboox says that they had to choose between a
language which is easy to teach such as Pascal, and a language
which is in common use in real application such as C, and they
compromised on using C but using a teaching style such as the one
commonly used to teach C. *ugh* They do not say explicitly they
use standard C, but they included appendices with the BNF syntax
of ANSI C (i.e. C89, that book predates C99), a list of the
identifiers declared in standard headers (at least they tried,
since I don't think SIG_ATOMIC_T or sseek_cur were spelt this way
in C89...), and the description of some functions (e.g. remove())
is a quite faithful translation of the Standard.

(But they even claim that main() is essentially shortand for
void main(void)...)

--
Army1987
(Replace "NOSPAM" with "email")

Jul 6 '07 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tomislav Lepusic | last post by:
Hello, I don't know if this is the right group (I'm more in Perl, know nothing about Python), so if you can help me thanks, if not, sorry to bother you. I'm working on my student project and...
1
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
2
by: Mj23 | last post by:
I'm Italian and I'm sorry for my English!!!I'm new of this ns and so I don't know if my question is suitable. I have a problem: using the C++ language,the QT library and the OpenGL library realize...
0
by: Prasanth U | last post by:
Hi All, We are facing a problem while integrating a HTML help file (chm version 1.x) to our windows .net application (C#). The help topic for the controls in the application are shown using the...
22
by: Rafia Tapia | last post by:
Hi all This is what I have in mind and I will appreciate any suggestions. I am trying to create a xml help system for my application. The schema of the xml file will be <helpsystem> <help...
3
by: Mitchell Thomas | last post by:
I hope someone out there can solve my mysterious problem. I have tried everything imaginable, even paid $35 to Microsoft to help me, but they were not able to figure out this problem: Here is the...
2
by: chanchito_cojones | last post by:
hi there, I am needing some help with a database I am putting together. The database works off of a main Form, which then has buttons on it that will open up other forms. The problem I am having...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.