Simple allocation of two buffer on AMD64

R

Richard Bos

Jack Klein said:
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
 
R

Richard Tobin

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
 
C

CBFalconer

Richard said:
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'.
 
R

Richard

CBFalconer said:
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.
 
C

Chris Dollin

Richard said:
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.
 
S

Spoon

jimenezrick said:
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.2.2/gcc/i386-and-x86_002d64-Options.html
 
R

Richard

Chris Dollin said:
Richard said:
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?

Kill the thread.

It is a point of contention because "Chuck" is constantly boring the
hole off everyone with HIS petty rejoinders on how posts should be
formed.

I am not sure which of many "not so nice" labels I could attach to him.

He has been pointed to other "for free" news services. He has had it
explained WHY major news readers clip the LAST delimited signature. He
has had it explained how certain news readers fail to auto clip his
garbage. The ball is firmly in his court. He is a hypocrite of the worst
order.
[1] Not just Richard-no-surname.
 
R

Richard Heathfield

CBFalconer said:

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

Chris Dollin

Richard said:
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.
 
E

Eric Sosman

Richard wrote On 11/02/07 09:58,:
Chris Dollin said:
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.
 
C

Chris Dollin

Eric said:
Richard wrote On 11/02/07 09:58,:
Chris Dollin said:
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?
 
R

Richard

Eric Sosman said:
Richard wrote On 11/02/07 09:58,:
Chris Dollin said:
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.
 
R

Richard

Chris Dollin said:
Richard said:
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.
 
R

Richard

Eric Sosman said:
Richard wrote On 11/02/07 09:58,:
Chris Dollin said:
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.

That's nice Eric, but it wasn't a competition ....
 
K

Kenny McCormack

Richard said:
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...
 
A

Army1987

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 *.)
 
J

jacob navia

CBFalconer said:
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.
 
D

Doug

That is uncalled for, irrelevant, and stupidly rude.




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

Keith Thompson

Richard said:
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.
 
M

Mark McIntyre

CBFalconer said:



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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top