473,503 Members | 3,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Struct size

Can anyone tell me the best way to find out the size of a struct, without
using the sizeof function? I'm currently thinking of:

struct foo s[2];
int size_of_foo = (char *)&s[1] - (char *)s;

but is there a more elegant way (e.g. requiring no memory).

Thanks in advance!
-Jeff
************************************************** ****************************
* *
* JEFF P. SYVERSON, PHD *
* Senior Systems Engineer *
* *
* CITRIC SOLUTIONS INC. -- 2495 SUNRISE BLVD -- RANCHO CORDOVA -- CA *
* *
************************************************** ****************************

This email and any file attachments(s) are confidential, may be legally
privileged, and are intended solely for use by the identified recipient(s). If
you received the email in error, please notify the sender and delete the
message and any copies completely from your computer. Dissemination,
distribution, or copying of this communication, in whole or in part, by any
unintended or unauthorized recipient is prohibited and may subject you to
liability under 18 U.S.C. sec. 2511. Citric Solutions, Inc. assumes no
liability and makes no warranties or representations that the email or any
file attachments are totally secure and/or virus free. The recipient is
advised to check for viruses prior to opening any file attached to the email.
Statements contained in the email or any file attachment may not be authorized
or endorsed by Citric Solutions, Inc. Citric Solutions, Inc. accepts no
liability, whether in contract, tort, or equity, for any unauthorized
statement or offer of contract communicated in the email or any file attached
by the sender.
Sep 20 '07 #1
42 2944
Jeff P. Syverson wrote:
Can anyone tell me the best way to find out the size of a struct, without
using the sizeof function? I'm currently thinking of:

struct foo s[2];
int size_of_foo = (char *)&s[1] - (char *)s;

but is there a more elegant way (e.g. requiring no memory).
Why, sizeof is there for a good reason
Thanks in advance!
-Jeff
************************************************** ****************************
* *
* JEFF P. SYVERSON, PHD *
* Senior Systems Engineer *
* *
* CITRIC SOLUTIONS INC. -- 2495 SUNRISE BLVD -- RANCHO CORDOVA -- CA *
* *
************************************************** ****************************

This email and any file attachments(s) are confidential, may be legally
privileged, and are intended solely for use by the identified recipient(s). If
you received the email in error, please notify the sender and delete the
message and any copies completely from your computer. Dissemination,
distribution, or copying of this communication, in whole or in part, by any
unintended or unauthorized recipient is prohibited and may subject you to
liability under 18 U.S.C. sec. 2511. Citric Solutions, Inc. assumes no
liability and makes no warranties or representations that the email or any
file attachments are totally secure and/or virus free. The recipient is
advised to check for viruses prior to opening any file attached to the email.
Statements contained in the email or any file attachment may not be authorized
or endorsed by Citric Solutions, Inc. Citric Solutions, Inc. accepts no
liability, whether in contract, tort, or equity, for any unauthorized
statement or offer of contract communicated in the email or any file attached
by the sender.
Surly you can trim all this nonsense?

--
Ian Collins.
Sep 20 '07 #2
Jeff P. Syverson said:
Can anyone tell me the best way to find out the size of a struct, without
using the sizeof function?
The designer of the C programming language, Dennis Ritchie, is one smart
cookie, and he saw at once, all those years ago, that it would simply not
be right for people to use a sizeof function to establish the sizes of
types and expressions of those types. So he invented a keyword, sizeof,
thus making it illegal (nowadays, we'd say "a constraint violation
requiring a diagnostic message") to even /write/ a function named sizeof.
You may therefore rest assured that it is impossible to use a sizeof
function (let alone *the* sizeof function) in C.

Incidentally, as well as rendering the creating of a function named sizeof
impossible, the sizeof keyword has a little-known secondary use - it
yields the size of its operand, in bytes. What's more, it evaluates this
size during the translation of the program, rather than waiting until
runtime, which is a nice touch.

So the answer to your question is this: the best way to find out the size
of a struct, without using the sizeof function, is to use the sizeof
keyword.

--
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
Sep 20 '07 #3
Ian Collins <ia******@hotmail.comwrote:
>Jeff P. Syverson wrote:
>... without using the sizeof function? ...
....
>Why, sizeof is there for a good reason
....
> [And then the grand finale, 15 lines of legalese]

Surly you can trim all this nonsense?
To all those who find this unusual, consider yourselves lucky you were
not forced to do the same.
There are companies that require this type of statements on outgoing
email. That text may have been added automatically by his employer
email system, with or without Mr. Syverson's consent.

Roberto Waltman

[ Please reply to the group,
return address is invalid ]
Sep 20 '07 #4
Eric Sosman said:

<snip>
One of the improvements should be the ability to
recognize and reject stupid requirements (another mark of
seniority and experience). "What's the most elegant and
efficient way to distinguish even numbers from odds without
using the notion of `two'?"
Another important attribute is the ability to meet stupid requirements
easily, quickly, and with a straight face:

int is_odd(unsigned long n)
{
return n & 1;
}

int is_even(unsigned long n)
{
return !is_odd(n);
}

Some fast talking may also be required.

--
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
Sep 20 '07 #5
On Sep 19, 10:18 pm, Roberto Waltman <use...@rwaltman.netwrote:
To all those who find this unusual, consider yourselves lucky you were
not forced to do the same.
There are companies that require this type of statements on outgoing
email. That text may have been added automatically by his employer
email system, with or without Mr. Syverson's consent.
IMO that is one of the few excellent reasons to use Google (or
anything other than one's employer e-mail) for posting. Given the
terms listed in the boilerplate, one could argue that Google is itself
an "unintended recipient" and therefore criminally liable for
"disseminating" the original post, not to mention a hapless responder
who quotes the original post.

Sep 20 '07 #6
Richard Heathfield <rj*@see.sig.invalidwrites:
[...]
The designer of the C programming language, Dennis Ritchie, is one smart
cookie, and he saw at once, all those years ago, that it would simply not
be right for people to use a sizeof function to establish the sizes of
types and expressions of those types. So he invented a keyword, sizeof,
thus making it illegal (nowadays, we'd say "a constraint violation
requiring a diagnostic message") to even /write/ a function named sizeof.
You may therefore rest assured that it is impossible to use a sizeof
function (let alone *the* sizeof function) in C.
[...]

A quibble: Attempting to declare a function named "sizeof" is not a
constraint violation requiring a diagnostic message. It's a syntax
rule violation requiring a diagnostic message.

--
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"
Sep 20 '07 #7
Keith Thompson said:
Richard Heathfield <rj*@see.sig.invalidwrites:
[...]
>The designer of the C programming language, Dennis Ritchie, is one smart
cookie, and he saw at once, all those years ago, that it would simply
not be right for people to use a sizeof function to establish the sizes
of types and expressions of those types. So he invented a keyword,
sizeof, thus making it illegal (nowadays, we'd say "a constraint
violation requiring a diagnostic message") to even /write/ a function
named sizeof. You may therefore rest assured that it is impossible to
use a sizeof function (let alone *the* sizeof function) in C.
[...]

A quibble: Attempting to declare a function named "sizeof" is not a
constraint violation requiring a diagnostic message. It's a syntax
rule violation requiring a diagnostic message.
In C89, it violates the constraint in 3.1.2:

"In translation phases 7 and 8, an identifier shall not consist of
the same sequence of characters as a keyword."

In C99, this constraint seems to have disappeared. So we're both right. :-)

--
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
Sep 20 '07 #8
"Jeff P. Syverson" <no****@nospam.comwrites:
Can anyone tell me the best way to find out the size of a struct, without
using the sizeof function? I'm currently thinking of:

struct foo s[2];
int size_of_foo = (char *)&s[1] - (char *)s;

but is there a more elegant way (e.g. requiring no memory).
It's easy to make the mistake of thinking that 'sizeof' is a function.
In fact, it's an operator. It's unusual in that it's the only
operator whose name is a keyword (which looks like an identifier)
rather than a token consisting of one or more punctuation marks.

Yes, I can think of a way to simplify your code slightly (you don't
need a 2-element array), but there's not much point in doing so.
You're asking the equivalent of "What's the best way to drive a nail
without using a hammer?", or "What's the best way to steer my car
without using the steering wheel?". In all three cases, there's
probably an answer, but the real answer is to use the right tool for
the job in the first place.

Explain *why* you don't want to use the sizeof operator, and perhaps
we can help. We get this question fairly frequently; it's usually a
homework question. The only valid reason I can think of to compute
the size of a struct without using 'sizeof' is to show how ugly the
resulting code is, demonstrating that including 'sizeof' as a built-in
operator was a really good idea.

--
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"
Sep 20 '07 #9
Roberto Waltman <us****@rwaltman.netwrites:
Ian Collins <ia******@hotmail.comwrote:
>>Jeff P. Syverson wrote:
>>... without using the sizeof function? ...
...
>>Why, sizeof is there for a good reason
...
>> [And then the grand finale, 15 lines of legalese]

Surly you can trim all this nonsense?

To all those who find this unusual, consider yourselves lucky you were
not forced to do the same.
There are companies that require this type of statements on outgoing
email. That text may have been added automatically by his employer
email system, with or without Mr. Syverson's consent.
But he's using an aioe.org NNTP server.

Mr. Syverson: If at all possible, please avoid including the huge
legal disclaimer in any future postings here. Usenet messages are not
e-mail; the disclaimer is meaningless (but I'm not a lawyer). If for
some reason you absolutely must include the disclaimer, please precede
it and your signature with a delimiter line consisting of "-- ".

--
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"
Sep 20 '07 #10
On Sep 19, 9:26 pm, Richard <rgr...@gmail.comwrote:
Why are you here? Will you post this to every question which is already
answered in google? Or did you just want to put your hand up and
announce yourself unwilling to help?
Well, I suppose it would have been more helpful if I had troubled
myself to locate the relevant posts myself, but it's not *my*
question. If you answer a man's question, he gets an A/a raise/the
warm glow of knowledge one time, but if you teach him to search the
Google archives, he can experience that euphoria for a lifetime, and
with no further tiresome importunement upon the group to boot.

Sep 20 '07 #11
Roberto Waltman wrote:
Ian Collins <ia******@hotmail.comwrote:
>Jeff P. Syverson wrote:
>>... without using the sizeof function? ...
...
>Why, sizeof is there for a good reason
...
>> [And then the grand finale, 15 lines of legalese]

Surly you can trim all this nonsense?

To all those who find this unusual, consider yourselves lucky you
were not forced to do the same. There are companies that require
this type of statements on outgoing email. That text may have been
added automatically by his employer email system, with or without
Mr. Syverson's consent.
However that was a Usenet entry, not e-mail. It should not have
gone through an email system at all. Of course his organization
may not be aware of all this, and still have forced the ridiculous
appendage, without even a sig marker.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

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

Sep 20 '07 #12
Eric Sosman wrote:
Richard wrote:
.... snip ...
>
>A Senior Systems Engineer doesn't have to know any C.

Twenty years ago, no. And twenty years from now, perhaps not.
But today, right now, a systems engineer ignorant of C -- even of
the bare basics of C -- ought not to carry the label "senior."
>And clearly he has an ulterior motive for not wanting to use
sizeof. I suspect home work for an "impprovement" course.

Ayeh. One of the improvements should be the ability to recognize
and reject stupid requirements (another mark of seniority and
experience). "What's the most elegant and efficient way to
distinguish even numbers from odds without using the notion of
`two'?"
And maybe someone should suggest that he get and read K&R2 and/or
the C standard. The links in my sig may help.

--
Some useful references about C:
<http://www.ungerhu.com/jxh/clc.welcome.txt>
<http://www.eskimo.com/~scs/C-faq/top.html (C-faq)
<http://benpfaff.org/writings/clc/off-topic.html>
<http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/(C99 std)
<http://www.dinkumware.com/refxc.html (C-library}
<http://gcc.gnu.org/onlinedocs/ (GNU docs)
<http://clc-wiki.net/wiki/C_community:comp.lang.c:Introduction>

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

Sep 20 '07 #13
On Thu, 20 Sep 2007 03:12:41 +0000, Richard Heathfield
<rj*@see.sig.invalidwrote:
>Eric Sosman said:

<snip>
>One of the improvements should be the ability to
recognize and reject stupid requirements (another mark of
seniority and experience). "What's the most elegant and
efficient way to distinguish even numbers from odds without
using the notion of `two'?"

Another important attribute is the ability to meet stupid requirements
easily, quickly, and with a straight face:

int is_odd(unsigned long n)
{
return n & 1;
}
Quick.
>int is_even(unsigned long n)
{
return !is_odd(n);
}
Easy.
>Some fast talking may also be required.
Fortunately, C99 introduced the keyword "inline". As a result, in the
above code, "Easy" should equate to "Quick"--just insert "inline" in
its proper place. It follows that no fast talking should be required.
Unless of course those requirement writers are savvy enough to ask
which C99 compiler you're using. Perhaps some fast-talking may well be
required.

Requirement writer: "Can you make it quick and easy"?
Programmer: "Yes".
Requirement writer: "What does that require"?
Programmer: "A C99 compiler".
Requirement writer: "That should be no problem, right, given that
we're in the year 2007"?
Programmer: "Yes, of course".
Requirement writer: "I'm curious, which C99 compiler will you be
using"?
Programmer: "Did you see that Bear's game last night"?

Regards
--
jay
Sep 20 '07 #14
"Eric Sosman" <es*****@ieee-dot-org.invalidschrieb im Newsbeitrag
news:3Y******************************@comcast.com. ..
a PhD in Experimental Theology
ROTFL, hilarious! Thanks for that, you made my day

bye, Jojo
Sep 20 '07 #15
On Thu, 20 Sep 2007 03:12:41 +0000, Richard Heathfield wrote:
Eric Sosman said:
[snip] "What's the most elegant and
>efficient way to distinguish even numbers from odds without
using the notion of `two'?"
return n & 1;
How do you explain what & does without using the notion of 'two'?
:-)
A better way:
n is even: ∃x ∈ ℤ ∣ x + x = n
n is odd: n ∈ ℤ ⋀ ¬(n is even)

(Yes, there are two x's in the sum above, but this doesn't use the
notion of 'two' anymore than the sentence "I am happy." uses the
notion of 'three' because it has three words, right?)
--
Army1987 (Replace "NOSPAM" with "email")
If you're sending e-mail from a Windows machine, turn off Microsoft's
stupid “Smart Quotes” feature. This is so you'll avoid sprinkling garbage
characters through your mail. -- Eric S. Raymond and Rick Moen

Sep 20 '07 #16
On Wed, 19 Sep 2007 21:49:25 -0400, Eric Sosman wrote:
Jeff P. Syverson wrote:
>Can anyone tell me the best way to find out the size of a struct, without
using the sizeof function? [...]

* JEFF P. SYVERSON, PHD *
* Senior Systems Engineer *
[... twenty-four lines of boilerplate all told]
OMG. I had not even noticed it. The last line in my screenful was
the blank line below -Jeff, and I didn't even consider scrolling
down.
--
Army1987 (Replace "NOSPAM" with "email")
If you're sending e-mail from a Windows machine, turn off Microsoft's
stupid “Smart Quotes” feature. This is so you'll avoid sprinkling garbage
characters through your mail. -- Eric S. Raymond and Rick Moen

Sep 20 '07 #17
Army1987 said:
On Thu, 20 Sep 2007 03:12:41 +0000, Richard Heathfield wrote:
>Eric Sosman said:
[snip] "What's the most elegant and
>>efficient way to distinguish even numbers from odds without
using the notion of `two'?"
> return n & 1;

How do you explain what & does without using the notion of 'two'?
:-)
Yields the result of performing a bitwise AND of all its operands.
A better way:
n is even: ?x ? ? ? x + x = n
n is odd: n ? ? ? (n is even)

(Yes, there are two x's in the sum above, but this doesn't use the
notion of 'two' anymore than the sentence "I am happy." uses the
notion of 'three' because it has three words, right?)
For the same reason, return n & 1; doesn't use the notion of "three".

--
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
Sep 20 '07 #18
Eric Sosman wrote:
>
Richard wrote:
[...]
And clearly he has an ulterior
motive for not wanting to use sizeof. I suspect home work for an
"impprovement" course.

Ayeh. One of the improvements should be the ability to
recognize and reject stupid requirements (another mark of
seniority and experience). "What's the most elegant and
efficient way to distinguish even numbers from odds without
using the notion of `two'?"
But first, define "even" and "odd" without using the notion of "two".

Then, define "prime" without using the notion of "division".

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
Sep 20 '07 #19
In article <46***************@spamcop.net>,
Kenneth Brody <ke******@spamcop.netwrote:
>But first, define "even" and "odd" without using the notion of "two".
Easily done, recursively.
>Then, define "prime" without using the notion of "division".
Doesn't the usual definition not use division? A natural number is
prime if it is not the product of two natural other than itself and
one.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Sep 20 '07 #20
Kenneth Brody said:
Eric Sosman wrote:
>>
Richard wrote:
[...]
And clearly he has an ulterior
motive for not wanting to use sizeof. I suspect home work for an
"impprovement" course.

Ayeh. One of the improvements should be the ability to
recognize and reject stupid requirements (another mark of
seniority and experience). "What's the most elegant and
efficient way to distinguish even numbers from odds without
using the notion of `two'?"

But first, define "even" and "odd" without using the notion of "two".
F(0) yields even. For n 0, F(n) yields odd iff F(n - 1) yields even.
Otherwise, it yields odd.

#define EVEN 0
#define ODD 1
int F(unsigned long n)
{
int result = EVEN;
if(n 0)
{
result = F(n - 1);
}
return result;
}
Then, define "prime" without using the notion of "division".
A prime is a positive integer greater than 1 that is not a multiple of any
other positive integer other than itself and 1.

--
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
Sep 20 '07 #21
Richard Heathfield said:
Kenneth Brody said:
<snip>
>But first, define "even" and "odd" without using the notion of "two".

F(0) yields even. For n 0, F(n) yields odd iff F(n - 1) yields even.
Otherwise, it yields odd.

#define EVEN 0
#define ODD 1
int F(unsigned long n)
{
int result = EVEN;
if(n 0)
{
result = F(n - 1);
}
return result;
}
Stupid. Sorry. All numbers are even!

Let me try that again:

#define EVEN 0
#define ODD 1
int F(unsigned long n)
{
int result = EVEN;
if(n 0)
{
if(F(n - 1) == EVEN)
{
result = ODD;
}
else
{
result = EVEN;
}
}
return result;
}

--
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
Sep 20 '07 #22
On Sep 20, 10:03 am, Kenneth Brody <kenbr...@spamcop.netwrote:
Eric Sosman wrote:
Richard wrote:
[...]
And clearly he has an ulterior
motive for not wanting to use sizeof. I suspect home work for an
"impprovement" course.
Ayeh. One of the improvements should be the ability to
recognize and reject stupid requirements (another mark of
seniority and experience). "What's the most elegant and
efficient way to distinguish even numbers from odds without
using the notion of `two'?"
But first, define "even" and "odd" without using the notion of "two".
'Even' is when a value (converted to unsigned) is shifted right by 1
and then shifted left by 1 and remains unchanged.
Then, define "prime" without using the notion of "division".
Easy. Replace 'division' with 'repeated subtraction that yields 0
before going negative'.
Sep 20 '07 #23
In article <11**********************@d55g2000hsg.googlegroups .com>,
user923005 <dc*****@connx.comwrote:
>But first, define "even" and "odd" without using the notion of "two".
>'Even' is when a value (converted to unsigned) is shifted right by 1
and then shifted left by 1 and remains unchanged.
This assumes the notion of shifting which is usually explained with
reference to base TWO, so I think you still have some work left.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Sep 20 '07 #24
On Sep 20, 1:00 pm, rich...@cogsci.ed.ac.uk (Richard Tobin) wrote:
In article <1190316948.616200.213...@d55g2000hsg.googlegroups .com>,

user923005 <dcor...@connx.comwrote:
But first, define "even" and "odd" without using the notion of "two".
'Even' is when a value (converted to unsigned) is shifted right by 1
and then shifted left by 1 and remains unchanged.

This assumes the notion of shifting which is usually explained with
reference to base TWO, so I think you still have some work left.
The C language may have used the notion of 2 in implementation of the
semantics of unsigned shifts, but I didn't.

Sep 20 '07 #25
"Kenneth Brody" <ke******@spamcop.neta crit dans le message de news:
46***************@spamcop.net...
Eric Sosman wrote:
>>
Jeff P. Syverson wrote:
Can anyone tell me the best way to find out the size of a struct,
without
using the sizeof function? [...]

Of course, the question "how do I get the size of something without
using the made-for-this sizeof operator" is along the same lines as
"how do I get the weight of something without using a scale". Sure,
it can be done, but why?
I suspect the OP wants to avoid the overhead of what he assumes to be a
function call. The answer is simple: for the purpose of computing the size
of a structure, sizeof is an operator evaluated at compile time.

Writing size=sizeof(struct foo); is exactly as efficient as writing size=16;

As a matter of fact, his proposal size=(char*)&foo_array[1]-(char*)&foo[0]
may well generate the same code, or something more complicated with a
subtraction and 2 relocations, to ultimately produce the same result.

--
Chqrlie.
Sep 20 '07 #26
Kenneth Brody wrote:
>
.... snip ...
>
But first, define "even" and "odd" without using the notion of
"two". Then, define "prime" without using the notion of "division".
A number that cannot be duplicated by any multiple of any smaller
number greater or equal to two. But division is more efficient.
:-)

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

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

Sep 20 '07 #27
In article <46***********************@news.free.fr>,
Charlie Gordon <ne**@chqrlie.orgwrote:
>I suspect the OP wants to avoid the overhead of what he assumes to be a
function call.
Given that the OP posted through a public news server with a
disclaimer referring to a company not (as far as I can see) mentioned
anywhere else on the Internet, my guess is that he is a troll.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Sep 20 '07 #28
In article <fc**********@pc-news.cogsci.ed.ac.uk>, I wrote:
>Given that the OP posted through a public news server with a
disclaimer referring to a company not (as far as I can see) mentioned
anywhere else on the Internet, my guess is that he is a troll.
A bit more searching reveals that a company with that name does exist,
and is an Indian outsourcing company. So I revise my guess to be that
he's doing that same Indian C course which has led so many other
people to ask the same question here recently.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Sep 20 '07 #29
Richard Tobin said:
In article <fc**********@pc-news.cogsci.ed.ac.uk>, I wrote:
>>Given that the OP posted through a public news server with a
disclaimer referring to a company not (as far as I can see) mentioned
anywhere else on the Internet, my guess is that he is a troll.

A bit more searching reveals that a company with that name does exist,
and is an Indian outsourcing company. So I revise my guess to be that
he's doing that same Indian C course which has led so many other
people to ask the same question here recently.
I wonder whether it's possible to killfile an entire sub-continent.

--
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
Sep 20 '07 #30
Richard Heathfield wrote:
I wonder whether it's possible to killfile an entire sub-continent.
You can kill file the whole world... much easier!
Sep 20 '07 #31
"Richard Tobin" <ri*****@cogsci.ed.ac.uka crit dans le message de news:
fc**********@pc-news.cogsci.ed.ac.uk...
In article <fc**********@pc-news.cogsci.ed.ac.uk>, I wrote:
>>Given that the OP posted through a public news server with a
disclaimer referring to a company not (as far as I can see) mentioned
anywhere else on the Internet, my guess is that he is a troll.

A bit more searching reveals that a company with that name does exist,
and is an Indian outsourcing company. So I revise my guess to be that
he's doing that same Indian C course which has led so many other
people to ask the same question here recently.
So it was a beg indian problem.

--
Chqrlie.
Sep 20 '07 #32
Charlie Gordon said:
"Richard Tobin" <ri*****@cogsci.ed.ac.uka crit dans le message de
news: fc**********@pc-news.cogsci.ed.ac.uk...
<snip>
>So I revise my guess to be that he's doing that same Indian C course
which has led so many other people to ask the same question here
recently.

So it was a beg indian problem.

You're not allowed to talk any more.
--
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
Sep 20 '07 #33
Richard Heathfield wrote:
Richard Tobin said:
>In article <fc**********@pc-news.cogsci.ed.ac.uk>, I wrote:
>>Given that the OP posted through a public news server with a
disclaimer referring to a company not (as far as I can see) mentioned
anywhere else on the Internet, my guess is that he is a troll.
A bit more searching reveals that a company with that name does exist,
and is an Indian outsourcing company. So I revise my guess to be that
he's doing that same Indian C course which has led so many other
people to ask the same question here recently.

I wonder whether it's possible to killfile an entire sub-continent.
That would be stupid and unjust, and also unjust and stupid,
not to mention unjust. Oh, and stupid, too. Need I say more more?

--
Eric Sosman
es*****@ieee-dot-org.invalid
Sep 21 '07 #34
On Wed, 19 Sep 2007 22:18:45 -0400, Roberto Waltman
<us****@rwaltman.netwrote:
>Ian Collins <ia******@hotmail.comwrote:
>>Jeff P. Syverson wrote:
>>... without using the sizeof function? ...
...
>>Why, sizeof is there for a good reason
...
>> [And then the grand finale, 15 lines of legalese]

Surly you can trim all this nonsense?

To all those who find this unusual, consider yourselves lucky you were
not forced to do the same.
There are companies that require this type of statements on outgoing
email. That text may have been added automatically by his employer
email system, with or without Mr. Syverson's consent.
Oddly enough, the sender had enough control to replace his email
address with no****@nospam.com. Makes one wonder why he couldn't get
rid of the boiler plate also.
Remove del for email
Sep 21 '07 #35
Eric Sosman said:
Richard Heathfield wrote:
>Richard Tobin said:
>>In article <fc**********@pc-news.cogsci.ed.ac.uk>, I wrote:

Given that the OP posted through a public news server with a
disclaimer referring to a company not (as far as I can see) mentioned
anywhere else on the Internet, my guess is that he is a troll.
A bit more searching reveals that a company with that name does exist,
and is an Indian outsourcing company. So I revise my guess to be that
he's doing that same Indian C course which has led so many other
people to ask the same question here recently.

I wonder whether it's possible to killfile an entire sub-continent.

That would be stupid and unjust, and also unjust and stupid,
not to mention unjust. Oh, and stupid, too. Need I say more more?
But, my dear chap, you haven't answered the question. I didn't ask whether
it would be sensible or just. I merely asked whether it would be possible.
:-)

--
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
Sep 21 '07 #36
Richard Heathfield wrote:
Eric Sosman said:
>Richard Heathfield wrote:
>>[...]
I wonder whether it's possible to killfile an entire sub-continent.
That would be stupid and unjust, and also unjust and stupid,
not to mention unjust. Oh, and stupid, too. Need I say more more?

But, my dear chap, you haven't answered the question. I didn't ask whether
it would be sensible or just. I merely asked whether it would be possible.
:-)
An apt summary of the thread's original question ...

--
Eric Sosman
es*****@ieee-dot-org.invalid
Sep 21 '07 #37
Eric Sosman <es*****@ieee-dot-org.invalidwrites:
Richard wrote:
>A Senior Systems
Engineer doesn't have to know any C.

Twenty years ago, no. And twenty years from now, perhaps
not. But today, right now, a systems engineer ignorant of C --
even of the bare basics of C -- ought not to carry the label
"senior."
Is a "systems engineer" necessarily someone who works on software
systems? I would not make that assumption.
--
Ben Pfaff
http://benpfaff.org
Sep 21 '07 #38
Ben Pfaff wrote, On 21/09/07 05:09:
Eric Sosman <es*****@ieee-dot-org.invalidwrites:
>Richard wrote:
>>A Senior Systems
Engineer doesn't have to know any C.
Twenty years ago, no. And twenty years from now, perhaps
not. But today, right now, a systems engineer ignorant of C --
even of the bare basics of C -- ought not to carry the label
"senior."

Is a "systems engineer" necessarily someone who works on software
systems? I would not make that assumption.
Nor would I having worked with Systems Engineers where the SW was only a
small part and said engineers would ask the SW Engineers for input on
SW, HW Engineers for input on HW, experts on optics for...
--
Flash Gordon
Sep 21 '07 #39
On Thu, 20 Sep 2007 15:46:31 +0000, Richard Heathfield wrote:
Army1987 said:
>On Thu, 20 Sep 2007 03:12:41 +0000, Richard Heathfield wrote:
>>Eric Sosman said:
[snip] "What's the most elegant and
>>>efficient way to distinguish even numbers from odds without
using the notion of `two'?"
>> return n & 1;

How do you explain what & does without using the notion of 'two'?
:-)

Yields the result of performing a bitwise AND of all its operands.
What does 'bitwise' mean? :-)

Btw, "n is even if (-1)**n is +1, odd if it is -1".

--
Army1987 (Replace "NOSPAM" with "email")
If you're sending e-mail from a Windows machine, turn off Microsoft's
stupid “Smart Quotes” feature. This is so you'll avoid sprinkling garbage
characters through your mail. -- Eric S. Raymond and Rick Moen

Sep 21 '07 #40
On Thu, 20 Sep 2007 17:41:22 -0700, Barry Schwarz <sc******@doezl.net>
wrote:
>On Wed, 19 Sep 2007 22:18:45 -0400, Roberto Waltman
<us****@rwaltman.netwrote:
>>Ian Collins <ia******@hotmail.comwrote:
>>>Jeff P. Syverson wrote:
... without using the sizeof function? ...
...
>>>Why, sizeof is there for a good reason
...
>>> [And then the grand finale, 15 lines of legalese]

Surly you can trim all this nonsense?

To all those who find this unusual, consider yourselves lucky you were
not forced to do the same.
There are companies that require this type of statements on outgoing
email. That text may have been added automatically by his employer
email system, with or without Mr. Syverson's consent.

Oddly enough, the sender had enough control to replace his email
address with no****@nospam.com. Makes one wonder why he couldn't get
rid of the boiler plate also.
If it were real company-required boilerplate, it would be added
*after* he hit the send button, unlike the email address.

--
Al Balmer
Sun City, AZ
Sep 21 '07 #41
Army1987 said:
Richard Heathfield wrote:
>Army1987 said:
>>Richard Heathfield wrote:
Eric Sosman said:
"What's the most elegant and efficient way to distinguish
even numbers from odds without using the notion of `two'?"

return n & 1;

How do you explain what & does without using the notion of 'two'?
:-)

Yields the result of performing a bitwise AND of all its operands.
What does 'bitwise' mean? :-)
It means "wise in the ways of small pieces". This is my last reply in this
subthread.

--
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
Sep 21 '07 #42
On Thu, 20 Sep 2007 13:03:03 -0400, Kenneth Brody wrote:
But first, define "even" and "odd" without using the notion of "two".

Then, define "prime" without using the notion of "division".
And then explain Goldbach's conjecture without using either notion.
But wait, hasn't Hofstadter already done that?
(Unless "the successor of the successor of b" uses the notion of
"two", but that was just a workaround because he couldn't use the
notion of "greater than".)
--
Army1987 (Replace "NOSPAM" with "email")
A hamburger is better than nothing.
Nothing is better than eternal happiness.
Therefore, a hamburger is better than eternal happiness.

Sep 22 '07 #43

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

Similar topics

13
83872
by: mike79 | last post by:
hi all.. if I wanted to malloc a struct, say the following: struct myStruct1 { int number; char *string; }
7
2174
by: ANaiveProgrammer | last post by:
Hi all I have made the following two structs and size is not according to what is supposed to be, so please ponder over following and identify if im wrong... please also mention what would be...
2
2455
by: Arne Styve | last post by:
Hi, I have an API written in C that came with some graphics cards we are going to use in a project. I need to write a small application where this API is to be used, and I decided to try out...
3
27194
by: Dirk Reske | last post by:
Hello, I have the following struct: public struct WAVEFORMATEX { public UInt16 wFormatTag; //2 bytes public UInt16 nChannels; //2 bytes public UInt32 nSamplesPerSec; //4 bytes...
1
3677
by: Marquee | last post by:
Hello, This is my first program c#, my background is c++. One thing I would like to do is put binary data (e.g. a record from disk, or network packet) in a struct. In C++ I would create the...
6
1929
by: Christian Kandeler | last post by:
Hi, I'd like to know whether the following code is standard-compliant: struct generic { int x; int a; };
7
1945
by: sarathy | last post by:
Hi, 1. How it that the results for the size of struct1 and struct2 (below) are 4 and 3 # include <stdio.h> struct struct1 { const :16;
3
4825
by: David Bear | last post by:
I found this simple recipe for converting a dotted quad ip address to a string of a long int. struct.unpack('L',socket.inet_aton(ip)) trouble is when I use this, I get struct.error: unpack...
1
2232
by: stromhau | last post by:
Hi, I have made a few classes in c++. They somehow cooperate doing some 3d stuff. Basically it is a moving camera acting as a flight, i have placed a lot of objects around the scene together with...
8
40445
by: cman | last post by:
What does this kind of typedef accomplish? typedef struct { unsigned long pte_low; } pte_t; typedef struct { unsigned long pgd; } pgd_t; typedef struct { unsigned long pgprot; } pgprot_t I am...
0
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5562
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.