473,394 Members | 1,951 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,394 software developers and data experts.

Simple allocation of two buffer on AMD64

- Code compiled by GCC:

int main(void)
{
char a[] = "123";
char b[] = "abc";

printf("%p %p\n", a, b);

return 0;
}

- Running it on AMD64 gives me:

0x7fff929c9410 0x7fff929c9400

- What is the reason for 16 bytes of distance between two address and
not just 8 bytes?

Nov 1 '07 #1
43 1831
ji*********@gmail.com wrote:
- Code compiled by GCC:

int main(void)
{
char a[] = "123";
char b[] = "abc";

printf("%p %p\n", a, b);

return 0;
}

- Running it on AMD64 gives me:

0x7fff929c9410 0x7fff929c9400

- What is the reason for 16 bytes of distance between two address and
not just 8 bytes?
Ask the gcc implementors. It was they who decided how
the compiler should allocate space, not the C language itself.
C does not require a sixteen-byte separation, but does not
forbid it.

--
Eric Sosman
es*****@ieee-dot-org.invalid
Nov 1 '07 #2
ji*********@gmail.com wrote:
- Code compiled by GCC:

int main(void)
{
char a[] = "123";
char b[] = "abc";

printf("%p %p\n", a, b);
Cast 'a' and 'b' to void *.
>
return 0;
}

- Running it on AMD64 gives me:

0x7fff929c9410 0x7fff929c9400

- What is the reason for 16 bytes of distance between two address and
not just 8 bytes?
It's an implementation detail that Standard C says nothing about. It may
be due to alignment reasons.

Nov 1 '07 #3
It's an implementation detail that Standard C says nothing about. It may
be due to alignment reasons.
I know. Just curiosity about the election of 16 bytes over 8 (what I
expected).

Thanks anyway.

Nov 1 '07 #4
On Nov 1, 7:54 am, santosh <santosh....@gmail.comwrote:
jimenezr...@gmail.com wrote:
char a[] = "123";
char b[] = "abc";
printf("%p %p\n", a, b);

Cast 'a' and 'b' to void *.
Correct me if I'm wrong, but isn't this technically a case where it
shouldn't matter, seeing as char * and void * have the exact same
representation?

Nov 1 '07 #5
Cast 'a' and 'b' to void *.

Same result.
Correct me if I'm wrong, but isn't this technically a case where it
shouldn't matter, seeing as char * and void * have the exact same
representation?
Yes, in this case is similar.

Nov 1 '07 #6
In article <11**********************@o3g2000hsb.googlegroups. com>,
Justin Spahr-Summers <Ju*****************@gmail.comwrote:
char a[] = "123";
char b[] = "abc";
printf("%p %p\n", a, b);
>Cast 'a' and 'b' to void *.
>Correct me if I'm wrong, but isn't this technically a case where it
shouldn't matter, seeing as char * and void * have the exact same
representation?
We discussed this a few weeks ago. The idea seems to be that although
they have the same representation, they aren't necessarily passed to
variadic functions in the same way.

-- Richard

--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Nov 1 '07 #7
ji*********@gmail.com wrote:
>
- Code compiled by GCC:

int main(void) {
char a[] = "123";
char b[] = "abc";

printf("%p %p\n", a, b);
return 0;
}

- Running it on AMD64 gives me:

0x7fff929c9410 0x7fff929c9400

- What is the reason for 16 bytes of distance between two address
and not just 8 bytes?
Many systems access memory in 128 bit chunks. Aligning objects to
this value prevents having to do two memory accesses, when one
suffices. Check the gcc docs for means of avoiding this if
desired.

--
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

Nov 1 '07 #8
ji*********@gmail.com wrote:
- Code compiled by GCC:

int main(void)
{
char a[] = "123";
char b[] = "abc";

printf("%p %p\n", a, b);

return 0;
}

- Running it on AMD64 gives me:

0x7fff929c9410 0x7fff929c9400

- What is the reason for 16 bytes of distance between two address and
not just 8 bytes?
That is, of course, an issue between your hardware, your OS, and the
version of gcc you are using. There is no reason, as far as C is
concerned, for the addresses of two distinct objects to have any
particular relationship. But your post is extremely amusing. The fact
that you think it somehow appropriate for the difference to be eight
when sizeof a and sizeof b are each four is hilarious.

You really should include <stdio.hwhen using the variadic function printf.
Even with the special relationship between the form of (void *) and
(char *), you should cast pointers to (void *) when using the "%p"
specifier, since that is what it signals.
Nov 1 '07 #9
ji*********@gmail.com wrote:
- Code compiled by GCC:

int main(void)
{
char a[] = "123";
char b[] = "abc";

printf("%p %p\n", a, b);

return 0;
}

- Running it on AMD64 gives me:

0x7fff929c9410 0x7fff929c9400

- What is the reason for 16 bytes of distance between two address and
not just 8 bytes?
The stack MUST be aligned to an 8 byte boundary in
64 bits AMD/Intel. If that fails, each access provokes
a misaligned read, what makes performance take a
big hit.

Access to XMM registers in most cases MUST be aligned to a
16 byte boundary. If not, you can't load the 16 byte
XMM registers quickly.

Some compilers decide that performance is better than
wasting memory in the alignment, and align all variables
in the stack to a 16 byte boundary even when it is not
needed, as in your example.

Other compilers will say that performance by loading the XMM
registers is lost when the cache hits go down because the
program uses more memory and will NOT align to a 16 byte
boundary but only to a 8 byte boundary what is bad enough.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Nov 1 '07 #10
jacob navia wrote:
>
.... snip ...

Date:
Fri, 02 Nov 2007 00:43:31 +0100

Your clock is mis-set.

--
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

Nov 1 '07 #11
On Nov 1, 4:28 pm, Martin Ambuhl <mamb...@earthlink.netwrote:
jimenezr...@gmail.com wrote:
- Code compiled by GCC:
int main(void)
{
char a[] = "123";
char b[] = "abc";
printf("%p %p\n", a, b);
return 0;
}
- Running it on AMD64 gives me:
<snip>
But your post is extremely amusing. The fact
that you think it somehow appropriate for the difference to be eight
when sizeof a and sizeof b are each four is hilarious.
You don't get out enough.

Aside from that, it would have probably been more helpful to explain
why, rather than just laughing.

To the OP, the definition of char 'a[] = "123;"' causes the compiler
to allocate space for exactly 4 characters (pedant point: or more, but
only 4 are 'legally' accessible by the code). Using sizeof on an
array is one of those cases where the array name doesn't degenerate to
a pointer to its first element - so 'sizeof a' will return 4
(characters) not sizeof (char *). (I think you probably expected 8
because the size of a pointer on your system is 8, and you expected
the compiler to emit two pointers in your stack frame.)

Of course, this isn't actually that relevant to your question - as
others have pointed out, the standard says nothing about how the
compiler has to layout locals in a stack frame (or even that it has to
use a stack), and Jacob has probably nailed why it ends up being 16
with your platform.

Doug

Nov 1 '07 #12
CBFalconer <cb********@yahoo.comwrites:
jacob navia wrote:
>>
... snip ...

Date:
Fri, 02 Nov 2007 00:43:31 +0100

Your clock is mis-set.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
And you are posting with two signatures. Still.
Nov 1 '07 #13
Doug wrote:
On Nov 1, 4:28 pm, Martin Ambuhl <mamb...@earthlink.netwrote:
>jimenezr...@gmail.com wrote:
>>- Code compiled by GCC:
int main(void)
{
char a[] = "123";
char b[] = "abc";
printf("%p %p\n", a, b);
return 0;
}
- Running it on AMD64 gives me:

<snip>
>But your post is extremely amusing. The fact
that you think it somehow appropriate for the difference to be eight
when sizeof a and sizeof b are each four is hilarious.

You don't get out enough.
That is uncalled for, irrelevant, and stupidly rude.
>
Aside from that, it would have probably been more helpful to explain
why, rather than just laughing.
If you had read what you snipped, you would know better than that. If
you snip away explanations, of course they disappear. From the
standpoint of the C programming language, everything you wrote after
this line is off-topic and superfluous. As was your childish crap above.
Nov 1 '07 #14
CBFalconer wrote:
jacob navia wrote:
... snip ...

Date:
Fri, 02 Nov 2007 00:43:31 +0100

Your clock is mis-set.
Yes. I just bought a new motherboard, and I forgot to set
the clock to the present instead of letting
it in the future.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Nov 1 '07 #15
On Thu, 01 Nov 2007 14:28:08 -0000, Justin Spahr-Summers
<Ju*****************@gmail.comwrote in comp.lang.c:
On Nov 1, 7:54 am, santosh <santosh....@gmail.comwrote:
jimenezr...@gmail.com wrote:
char a[] = "123";
char b[] = "abc";
printf("%p %p\n", a, b);
Cast 'a' and 'b' to void *.

Correct me if I'm wrong, but isn't this technically a case where it
shouldn't matter, seeing as char * and void * have the exact same
representation?
Yes and no. It doesn't matter, they are compatible in this case, but
not because they have the same representation.

Pointer to void and pointer to any of the three character types are
required to have the same size and representation, but nowhere does
the C standard that they be passed to functions in the same manner, in
the absence of a prototype.

The relevant definition on representation is 6.2.5 p26, first
sentence:

"A pointer to void shall have the same representation and alignment
requirements as a pointer to a character type.39)"

Where the "39)" is a reference to footnote 39, on the same page:

"39) The same representation and alignment requirements are meant to
imply interchangeability as arguments to functions, return values from
functions, and members of unions."

My reading of this is that implementations are strongly urged, but not
required, to make them compatible in all of these situations. It is a
quality of implementation whether they are or not.

But in the particular case of an argument to *printf() to match a "%p"
conversion specifier, compatibility is guaranteed by specific wording
in the standard by 6.5.2.2 p6.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Nov 2 '07 #16
"Richard" <rg****@gmail.comwrote in message
news:9u************@news.individual.net...
CBFalconer <cb********@yahoo.comwrites:
>jacob navia wrote:
>>>
... snip ...

Date:
Fri, 02 Nov 2007 00:43:31 +0100

Your clock is mis-set.

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

And you are posting with two signatures. Still.
Like me, the post leaves his machine with a single signature. The second
one is added by our news server. If your client were designed correctly, it
would strip off both signatures when replying since the first, not last,
occurrence of "-- " denotes the start of the signature block. Technically,
it's all one overlong signature with a spurious "-- " in the middle.

S

--
Stephen Sprunk "God does not play dice." --Albert Einstein
CCIE #3723 "God is an inveterate gambler, and He throws the
K5SSS dice at every possible opportunity." --Stephen Hawking
--
Posted via a free Usenet account from http://www.teranews.com

Nov 2 '07 #17
"Stephen Sprunk" <st*****@sprunk.orgwrites:
"Richard" <rg****@gmail.comwrote in message
news:9u************@news.individual.net...
>CBFalconer <cb********@yahoo.comwrites:
>>jacob navia wrote:

... snip ...

Date:
Fri, 02 Nov 2007 00:43:31 +0100

Your clock is mis-set.

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

And you are posting with two signatures. Still.

Like me, the post leaves his machine with a single signature. The
second one is added by our news server. If your client were designed
Which is why you should either leave off the second signature OR move to
another news service which does not attach another one.
correctly, it would strip off both signatures when replying since the
first, not last, occurrence of "-- " denotes the start of the
signature block. Technically, it's all one overlong signature with a
spurious "-- " in the middle.
Incorrect from what i can gather. The proper way is to clip the
last. otherwise it is possible that embedded text could be cut.

Both gnus and slrn suffer and I can't be bothered to manually snip since
he, and now you, are the ONLY two people who feel that posting with two
signatures is in anyway ok or justified.

It's just a question of common decency and trying to keep usenet a civil
place. Normally I wouldn't worry too much but since 4 out of 5 of
Falconer's posts criticise the way other people post it is an issue. As
someone said - he is a hypocrite.
S

--
Stephen Sprunk "God does not play dice." --Albert Einstein
CCIE #3723 "God is an inveterate gambler, and He throws the
K5SSS dice at every possible opportunity." --Stephen Hawking
Nov 2 '07 #18
Stephen Sprunk wrote:
"Richard" <rg****@gmail.comwrote in message
news:9u************@news.individual.net...
>CBFalconer <cb********@yahoo.comwrites:
>>jacob navia wrote:

... snip ...

Date:
Fri, 02 Nov 2007 00:43:31 +0100

Your clock is mis-set.

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

And you are posting with two signatures. Still.

Like me, the post leaves his machine with a single signature. The
second
one is added by our news server. If your client were designed
correctly, it would strip off both signatures when replying
As does KNode for example.
since the first, not last,
occurrence of "-- " denotes the start of the signature block.
Technically, it's all one overlong signature with a spurious "-- " in
the middle.
I agree.

Nov 2 '07 #19
In article <l1********************************@4ax.com>,
Jack Klein <ja*******@spamcop.netwrote:
>"39) The same representation and alignment requirements are meant to
imply interchangeability as arguments to functions, return values from
functions, and members of unions."

My reading of this is that implementations are strongly urged, but not
required, to make them compatible in all of these situations. It is a
quality of implementation whether they are or not.
My reading is that they had not considered the possibility of
different argument passing conventions when they wrote that text. If
they had, they should have been explicit about it.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Nov 2 '07 #20
"Stephen Sprunk" <st*****@sprunk.orgwrote:
"Richard" <rg****@gmail.comwrote in message
news:9u************@news.individual.net...
CBFalconer <cb********@yahoo.comwrites:
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
And you are posting with two signatures. Still.

Like me, the post leaves his machine with a single signature. The second
one is added by our news server.
And like for him, that is a piss-poor excuse for you. You _know_ your
server does that. You should take it into account when writing your
posts.

Richard
Nov 2 '07 #21
Jack Klein <ja*******@spamcop.netwrote:
But in the particular case of an argument to *printf() to match a "%p"
conversion specifier, compatibility is guaranteed by specific wording
in the standard by 6.5.2.2 p6.
Is it? How? AFAICT, what that guarantees is that in the program in
question - which did not declare printf() - the call to printf() in its
entirety has undefined behaviour. Because what it says is:

# If the expression that denotes the called function has a type that
# does not include a prototype...

(which is the case here), and:

# If the function is defined with a type that includes a prototype, and
# either the prototype ends with an ellipsis (,...)...

(which is also the case here), then:

# the behavior is undefined.

IYAM, this takes precedence over the _following_ sentence which states
that an _explicit_ void * declared parameter is compatible with a char *
argument. In fact, since the expected void * is not _declared_ in the
printf() prototype, that sentence does not even apply.

Richard
Nov 2 '07 #22
In article <l1********************************@4ax.com>,
Jack Klein <ja*******@spamcop.netwrote:
>But in the particular case of an argument to *printf() to match a "%p"
conversion specifier, compatibility is guaranteed by specific wording
in the standard by 6.5.2.2 p6.
The whole of p6 applies only to cases where "the expression that
denotes the called function has a type that does not include a
prototype".

-- Richard

--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Nov 2 '07 #23
Richard Bos wrote:
"Stephen Sprunk" <st*****@sprunk.orgwrote:
>"Richard" <rg****@gmail.comwrote in message
>>And you are posting with two signatures. Still.

Like me, the post leaves his machine with a single signature.
The second one is added by our news server.

And like for him, that is a piss-poor excuse for you. You _know_
your server does that. You should take it into account when
writing your posts.
When will all of you realize that BOTH our posts arrive at the
destination with only one sig. The sig is slightly longer than we
posted. A sig consists of everything that follows the earliest
sig. marker. There is no such thing in Usenet as a 'double sig'.

--
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

Nov 2 '07 #24
CBFalconer <cb********@yahoo.comwrites:
Richard Bos wrote:
>"Stephen Sprunk" <st*****@sprunk.orgwrote:
>>"Richard" <rg****@gmail.comwrote in message

And you are posting with two signatures. Still.

Like me, the post leaves his machine with a single signature.
The second one is added by our news server.

And like for him, that is a piss-poor excuse for you. You _know_
your server does that. You should take it into account when
writing your posts.

When will all of you realize that BOTH our posts arrive at the
destination with only one sig. The sig is slightly longer than we
posted. A sig consists of everything that follows the earliest
sig. marker. There is no such thing in Usenet as a 'double sig'.
Wrong. Again. And has been explained to you 10000 times.

The sig is the last delimited section as EVERY OTHER POSTER on usenet
understands and adheres to.
>
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Nov 2 '07 #25
Richard wrote:
CBFalconer <cb********@yahoo.comwrites:
>Richard Bos wrote:
>>"Stephen Sprunk" <st*****@sprunk.orgwrote:
"Richard" <rg****@gmail.comwrote in message

And you are posting with two signatures. Still.

Like me, the post leaves his machine with a single signature.
The second one is added by our news server.

And like for him, that is a piss-poor excuse for you. You _know_
your server does that. You should take it into account when
writing your posts.

When will all of you realize that BOTH our posts arrive at the
destination with only one sig. The sig is slightly longer than we
posted. A sig consists of everything that follows the earliest
sig. marker. There is no such thing in Usenet as a 'double sig'.

Wrong. Again. And has been explained to you 10000 times.

The sig is the last delimited section as EVERY OTHER POSTER on usenet
understands and adheres to.
For Thor's sake, if you're [1] going to argue, argue about something more
contentful then whether Chuck has one big sig or two consecutive smaller
ones or one signature with something siglike just in front of it.

Please?

[1] Not just Richard-no-surname.

--
Chris "if someone RFCs this I shall SCREAM" Dollin

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England

Nov 2 '07 #26
jimenezrick wrote:
Code compiled by GCC:

int main(void)
{
char a[] = "123";
char b[] = "abc";

printf("%p %p\n", a, b);

return 0;
}

Running it on AMD64 gives me:

0x7fff929c9410 0x7fff929c9400

What is the reason for 16 bytes of distance between two address and
not just 8 bytes?
Try -mpreferred-stack-boundary=3

Attempt to keep the stack boundary aligned to a 2^n byte boundary.
If -mpreferred-stack-boundary is not specified, the default is 4
(16 bytes or 128 bits).

http://gcc.gnu.org/onlinedocs/gcc-4....4-Options.html
Nov 2 '07 #27
CBFalconer said:

<snip>
When will all of you realize that BOTH our posts arrive at the
destination with only one sig.
Whether it's one overly-long sig or two shorter ones doesn't actually
matter. Either way, it's still a broken sig. And "destination" means
"where it ends up". HERE in my client, which is one of the places it ends
up, it's a broken sig. Practically everybody else in the group manages to
get this right.

Now, personally I couldn't give a tinker's cuss that it's broken. What I
don't like is the hypocrisy of criticising other people's netiquette
violations when every single article you post breaches netiquette
conventions.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 2 '07 #28
Richard wrote:
Chris Dollin <ch**********@hp.comwrites:
>For Thor's sake, if you're [1] going to argue, argue about something more
contentful then whether Chuck has one big sig or two consecutive smaller
ones or one signature with something siglike just in front of it.

Please?

Kill the thread.
I'd much rather you-all stopped freelling arguing about Chuck's sig and
argued about something constructive. Or argued constructively about
something. I can't stop anyone from looking like an idiot -- if I could,
I'd start with myself -- but there's limited amusement value in /this/
kind of mud-wrestling.

--
Chris "unfond memories of the playground" Dollin

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

Nov 2 '07 #29
Richard wrote On 11/02/07 09:58,:
Chris Dollin <ch**********@hp.comwrites:
>>For Thor's sake, if you're [1] going to argue, argue about something more
contentful then whether Chuck has one big sig or two consecutive smaller
ones or one signature with something siglike just in front of it.

Please?


Kill the thread.
I have an even better idea.

--
Er*********@sun.com
Nov 2 '07 #30
Eric Sosman wrote:
Richard wrote On 11/02/07 09:58,:
>Chris Dollin <ch**********@hp.comwrites:
>>>For Thor's sake, if you're [1] going to argue, argue about something more
contentful then whether Chuck has one big sig or two consecutive smaller
ones or one signature with something siglike just in front of it.

Please?


Kill the thread.

I have an even better idea.
But it's too large to fit in your margin\\\\\\signature?

--
Chris "will shut up now, but not forever" Dollin

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

Nov 2 '07 #31
Chris Dollin <ch**********@hp.comwrites:
Richard wrote:
>Chris Dollin <ch**********@hp.comwrites:
>>For Thor's sake, if you're [1] going to argue, argue about something more
contentful then whether Chuck has one big sig or two consecutive smaller
ones or one signature with something siglike just in front of it.

Please?

Kill the thread.

I'd much rather you-all stopped freelling arguing about Chuck's sig and
argued about something constructive. Or argued constructively about
something. I can't stop anyone from looking like an idiot -- if I could,
I'd start with myself -- but there's limited amusement value in /this/
kind of mud-wrestling.
Tell you what : when you start telling "Chuck" off for lecturing other
posters on posting etiquette I will consider not pointing out his
hypocrisy.

FWIW, this IS constructive. As Chuck never tires of telling everyone,
keeping to certain niceties makes usenet a nicer place for all of us.

Nov 2 '07 #32
Eric Sosman <Er*********@sun.comwrites:
Richard wrote On 11/02/07 09:58,:
>Chris Dollin <ch**********@hp.comwrites:
>>>For Thor's sake, if you're [1] going to argue, argue about something more
contentful then whether Chuck has one big sig or two consecutive smaller
ones or one signature with something siglike just in front of it.

Please?


Kill the thread.

I have an even better idea.
So do I. "Chuck" sorts it out OR stops lecturing other people on how to
post.

Nov 2 '07 #33
In article <d5************@news.individual.net>,
Richard <rg****@gmail.comwrote:
....
>Tell you what : when you start telling "Chuck" off for lecturing other
posters on posting etiquette I will consider not pointing out his
hypocrisy.

FWIW, this IS constructive. As Chuck never tires of telling everyone,
keeping to certain niceties makes usenet a nicer place for all of us.
Yes, but you forget one little important detail.

It is not permissable to attack a regular.

In fact, here as in real life, the best way to make yourself immune to
attacks on your own pecadilos is to become known for attacking others.
The mass public just doesn't see any inconsistency here...

Nov 2 '07 #34
On Thu, 01 Nov 2007 14:28:08 +0000, Justin Spahr-Summers wrote:
On Nov 1, 7:54 am, santosh <santosh....@gmail.comwrote:
> jimenezr...@gmail.com wrote:
char a[] = "123";
char b[] = "abc";
printf("%p %p\n", a, b);

Cast 'a' and 'b' to void *.

Correct me if I'm wrong, but isn't this technically a case where it
shouldn't matter, seeing as char * and void * have the exact same
representation?
It could fail as far as the standard is concerned, but it'd need
that:
1. printf() retrieves the arguments by some mechanism other than
va_arg();
2. either
2a. the compiler / linker does some magic to ensure that
void *s and char *s are passed the same way to variadic
functions using va_arg() but in different ways to variadic
functions which use some other mechanism, or
2b. char *s and void *s are indeed passed in different ways,
but somehow va_arg() is able to read both types in both
ways, and the mechanism printf() uses doesn't.
Not impossible, but almost as unlikely as the number of bits in
UINT_MAX not fitting in a signed int...
(Anyway, the cost of making it work on a DS9K is very low, so I
can't see any reason not to cast to void *.)
--
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.

Nov 2 '07 #35
On Nov 1, 9:08 pm, Martin Ambuhl <mamb...@earthlink.netwrote:
Doug wrote:
On Nov 1, 4:28 pm, Martin Ambuhl <mamb...@earthlink.netwrote:
But your post is extremely amusing. The fact
that you think it somehow appropriate for the difference to be eight
when sizeof a and sizeof b are each four is hilarious.
You don't get out enough.

That is uncalled for, irrelevant, and stupidly rude.
Aside from that, it would have probably been more helpful to explain
why, rather than just laughing.

If you had read what you snipped, you would know better than that. If
you snip away explanations, of course they disappear. From the
standpoint of the C programming language, everything you wrote after
this line is off-topic and superfluous. As was your childish crap above.- Hide quoted text -
You're done laughing, then?

Nov 2 '07 #36
Richard <rg****@gmail.comwrites:
[...]
Both gnus and slrn suffer and I can't be bothered to manually snip since
he, and now you, are the ONLY two people who feel that posting with two
signatures is in anyway ok or justified.
You can't be bothered to manually snip? Then *you* are posting
improperly, and by your own logic you have no right to criticize
anyone else for doing so.

If the first 100 times you complained about this had no effect, do you
think that the 101st will do the trick? Either snip the signature
yourself (as I do on every followup I post; it's not difficult) or
don't respond to posts from teranews.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Looking for software development work in the San Diego area.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Nov 3 '07 #37
On Fri, 02 Nov 2007 14:40:15 +0000, in comp.lang.c , Richard
Heathfield <rj*@see.sig.invalidwrote:
>CBFalconer said:

<snip>
>When will all of you realize that BOTH our posts arrive at the
destination with only one sig.

Whether it's one overly-long sig or two shorter ones doesn't actually
matter.
This is the most childish, ludicrous argument I've seen here since
before Dan Pop left. Richard(s) ought to be embarrassed to be carrying
it on, its like children in the playground shouting yah-boo-sucks at
each other. My five-year-old behaves like this, but he's got an
excuse.

Grow up all of you.

--
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
Nov 4 '07 #38
"Richard" <rg****@gmail.comwrote in message
news:0k************@news.individual.net...
"Stephen Sprunk" <st*****@sprunk.orgwrites:
>"Richard" <rg****@gmail.comwrote in message
news:9u************@news.individual.net...
>>And you are posting with two signatures. Still.

Like me, the post leaves his machine with a single signature.
The second one is added by our news server. If your client were
designed

Which is why you should either leave off the second signature OR
move to another news service which does not attach another one.
My ISP doesn't have a news server, I'm unwilling to pay for non-binaries
usenet access, and I'm not aware of any other free NNTP server; if you're
aware of one that carries all the groups I'm interested in and charges
nothing, I'll happily move. Teranews has stability problems I'm not happy
with anyways.
>correctly, it would strip off both signatures when replying since
the first, not last, occurrence of "-- " denotes the start of the
signature block. Technically, it's all one overlong signature with
a spurious "-- " in the middle.

Incorrect from what i can gather. The proper way is to clip the
last.
RFC 3676 implies the sig-sep sequence can only exist once per message since
it separates the body from the signature; however, it is referenced as a
"convention" and not a standard, so there is no official "proper" way to
handle multiple sig-seps (nor a standards violation when it happens). In
that case, any interpretation is valid, though I find one to be more obvious
and sensible than the other(s). The simplest way to code a newsreader is to
search for the _first_ occurrence of sig-sep and cut there, and it's no
surprise that the majority do it that way.
otherwise it is possible that embedded text could be cut.
Anyone who intentionally puts CLRF DASH DASH SP CRLF in their message body
deserves what they get.
Both gnus and slrn suffer
Then submit patches if it bugs you. My newsreader is too stupid to strip
_any_ signatures, so I never noticed the problem.
and I can't be bothered to manually snip
since he, and now you, are the ONLY two people who feel that
posting with two signatures is in anyway ok or justified.
I don't feel it's "okay" or "justified", but at the moment I'm not aware of
any other acceptable options. I find giving up my ability to put my _own_
signature on a message to be unacceptable; you obviously have a different
opinion, and that's fine. To each their own.

S

--
Stephen Sprunk "God does not play dice." --Albert Einstein
CCIE #3723 "God is an inveterate gambler, and He throws the
K5SSS dice at every possible opportunity." --Stephen Hawking
--
Posted via a free Usenet account from http://www.teranews.com

Nov 7 '07 #39
"Stephen Sprunk" <st*****@sprunk.orgwrites:
"Richard" <rg****@gmail.comwrote in message
news:0k************@news.individual.net...
>"Stephen Sprunk" <st*****@sprunk.orgwrites:
>>"Richard" <rg****@gmail.comwrote in message
news:9u************@news.individual.net...
And you are posting with two signatures. Still.

Like me, the post leaves his machine with a single signature.
The second one is added by our news server. If your client were
designed

Which is why you should either leave off the second signature OR
move to another news service which does not attach another one.

My ISP doesn't have a news server, I'm unwilling to pay for
non-binaries usenet access, and I'm not aware of any other free NNTP
server; if you're aware of one that carries all the groups I'm
They have been posted umpteen times here in response to CBFalconer's
apparent belief that he is beyond the rules and standards he sets for
everyone else.

http://motzarella.org/

or 1.1 seconds with google

http://groups.google.com/group/alt.c...63d15e883e1c18

and a million other matches.

interested in and charges nothing, I'll happily move. Teranews has
stability problems I'm not happy with anyways.
>
>>correctly, it would strip off both signatures when replying since
the first, not last, occurrence of "-- " denotes the start of the
signature block. Technically, it's all one overlong signature with
a spurious "-- " in the middle.

Incorrect from what i can gather. The proper way is to clip the
last.

RFC 3676 implies the sig-sep sequence can only exist once per message
since it separates the body from the signature; however, it is
referenced as a "convention" and not a standard, so there is no
official "proper" way to handle multiple sig-seps (nor a standards
It really is quite simple. You and Falconer are the only TWO in all the
groups I inhabit who post with two signatures. It breaks the clipping of
at least SLRN and GNUS - two of the most mature and powerful readers out
there.

So enough about standards etc - do the decent thing and
stop posting with double signatures. It annoys the hell out of a lot of
people. Trying to warp the RFC into something which supports something
as plainly stupid as a double sig is a waste of your talents IMO.
Nov 7 '07 #40
Stephen Sprunk wrote:
My ISP doesn't have a news server, I'm unwilling to pay for non-binaries
usenet access, and I'm not aware of any other free NNTP server; if
you're aware of one that carries all the groups I'm interested in and
charges nothing, I'll happily move. Teranews has stability problems I'm
not happy with anyways.
<OT>I'm happy with the free service provided by news.aioe.org </OT>

--
Philip Potter pgp <atdoc.ic.ac.uk
Nov 7 '07 #41
On Wednesday 07 Nov 2007 9:17 pm Stephen Sprunk <st*****@sprunk.org>
wrote in article <47***********************@free.teranews.com>:
"Richard" <rg****@gmail.comwrote in message
news:0k************@news.individual.net...
>"Stephen Sprunk" <st*****@sprunk.orgwrites:
<snip>
>>correctly, it would strip off both signatures when replying since
the first, not last, occurrence of "-- " denotes the start of the
signature block. Technically, it's all one overlong signature with
a spurious "-- " in the middle.

Incorrect from what i can gather. The proper way is to clip the
last.

RFC 3676 implies the sig-sep sequence can only exist once per message
since it separates the body from the signature;
Yes.
>otherwise it is possible that embedded text could be cut.

Anyone who intentionally puts CLRF DASH DASH SP CRLF in their message
body deserves what they get.
Yes.
>Both gnus and slrn suffer

Then submit patches if it bugs you. My newsreader is too stupid to
strip _any_ signatures, so I never noticed the problem.
FWIW Knode correctly strips out both your sigs when I hit REPLY. So does
Pan and XNews. I'm surprised GNUS has trouble in this regard. Many
consider it among the most flexible newsreaders.

<snip>

Nov 7 '07 #42
"Philip Potter" <pg*@see.sig.invalidwrote in message
news:fg**********@aioe.org...
Stephen Sprunk wrote:
>My ISP doesn't have a news server, I'm unwilling to pay for non-
binaries usenet access, and I'm not aware of any other free NNTP
server; if you're aware of one that carries all the groups I'm
interested in and charges nothing, I'll happily move. Teranews
has stability problems I'm not happy with anyways.

<OT>I'm happy with the free service provided by news.aioe.org </OT>
Thanks for the pointer, and likewise to the person who suggested it
privately. aioe appears to suck less than Teranews.

S

--
Stephen Sprunk "God does not play dice." --Albert Einstein
CCIE #3723 "God is an inveterate gambler, and He throws the
K5SSS dice at every possible opportunity." --Stephen Hawking

Nov 13 '07 #43
"Stephen Sprunk" <st*****@sprunk.orga écrit dans le message de news:
fh**********@aioe.org...
"Philip Potter" <pg*@see.sig.invalidwrote in message
news:fg**********@aioe.org...
>Stephen Sprunk wrote:
>>My ISP doesn't have a news server, I'm unwilling to pay for non-
binaries usenet access, and I'm not aware of any other free NNTP
server; if you're aware of one that carries all the groups I'm
interested in and charges nothing, I'll happily move. Teranews
has stability problems I'm not happy with anyways.

<OT>I'm happy with the free service provided by news.aioe.org </OT>

Thanks for the pointer, and likewise to the person who suggested it
privately. aioe appears to suck less than Teranews.
Except for the Keith Thomson issue: his post do not show up on aioe.org
these days, and neither do they on free.fr nor motzarella.org

--
Chqrlie.
Nov 13 '07 #44

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

Similar topics

8
by: jason | last post by:
i'm a little new to VC++, so i'm curious how to appropriate perform the following task. there is a pointer which i wish you point to a buffer of frequently changing size. i'm wondering what is...
51
by: Alan | last post by:
hi all, I want to define a constant length string, say 4 then in a function at some time, I want to set the string to a constant value, say a below is my code but it fails what is the correct...
8
by: Ross A. Finlayson | last post by:
I'm trying to write some C code, but I want to use C++'s std::vector. Indeed, if the code is compiled as C++, I want the container to actually be std::vector, in this case of a collection of value...
10
by: AlabiChin | last post by:
Hello, I noticed that when I dynamically create an array of chars, the resulting size of the allocated memory block is larger by about 15 bytes than what I specified. Here is example code: ...
5
by: collection60 | last post by:
Hi people, I am writing a library that will implement a binary file format. Well... I'm thinking, as a design, it would be nice to have my library able to promise to not use more than a...
66
by: Johan Tibell | last post by:
I've written a piece of code that uses sockets a lot (I know that sockets aren't portable C, this is not a question about sockets per se). Much of my code ended up looking like this: if...
0
by: He Shiming | last post by:
Hi All, In my COM (component object model) server DLL I created, there are these methods that require buffer allocation. They look like this: class CComClass : public IClass { // just for...
10
by: kid joe | last post by:
Hi all, I'm using a temporary buffer to transfer some data and would rather not allocate it on the heap. The problem is that the size of the buffer is only known upon entry into the function...
4
by: Jung, William | last post by:
I have a function that convert a string to binary, where - string is the string needs to convert to binary. - binary is the BYTE array to hold the converted data StringtoBinary( LPCSTR string,...
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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.