Monday, January 22, 2018

Digest for comp.lang.c++@googlegroups.com - 10 updates in 5 topics

asetofsymbols@gmail.com: Jan 22 12:20AM -0800

Do not think that everyone is against you here... I agree that some Cristian religion and proselytism to Bible is not ot
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 22 06:39PM

> Do not think that everyone is against you here... I agree that some Cristian religion and proselytism to Bible is not ot
 
In which case you are also a member of the fucktard club.
 
/Flibble
 
--
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates
a world that is so full of injustice and pain. That's what I would say."
Daniel <danielaparker@gmail.com>: Jan 22 12:14PM -0800

On Saturday, January 20, 2018 at 5:27:49 PM UTC-5, Mr Flibble wrote:
 
> > Are you afraid of the truth ...?
 
> You are simply asserting that what you believe is true; you have no
> evidence to backup such as assertion.
 
For Rick, the "truth" is something that originates inside his head. That's why it's difficult to argue with him, it's hard to argue with what's going on inside his own head. Ultimately, the biblical texts are only important to
him in so far as the voices in his head tell him that they are, if they told
him about some other texts, he'd go with them. Assuming Rick is intelligent,
and there's no reason to think he isn't, and assuming he reads, he'll
almost certainly come across information about many people who hear voices in their heads and that tell them strange things. The great mathematician John Nash was once asked why he believed aliens were trying to contact him
through the classifieds in the New York Times, and he replied that his ideas
about aliens came to him in the same way as his ideas about mathematics, so
he had to take them seriously. Maybe Rick can think about information
like this, and start questioning whether what's happening inside his own
head is real. Or maybe not.
 
Daniel
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 22 06:40PM

Hi!
 
I don't know if Christianity is a religion or not! LOL! I'mma newb that
would probably make Geesus Crust mad!
 
Lulz. :p
 
--
 
Thank you,
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jan 22 07:00PM

On 22/01/2018 18:40, Rick C. Hodgin wrote:
 
> I don't know if Christianity is a religion or not! LOL! I'mma newb that
> would probably make Geesus Crust mad!
 
> Lulz. :p
 
Sorry I spelt Cheesus Crust's name wrong! My bad! LOL
 
--
 
Thank you,
Rick C. Hodgin
Bo Persson <bop@gmb.dk>: Jan 22 02:42PM +0100

On 2018-01-22 14:24, arnuld wrote:
> arr[3][2] = arr[0x7ffda9f1ea10[0x7ffda9f1ea00]
> arr[3][3] = arr[0x7ffda9f1ea10[0x7ffda9f1ea10]
> [arnuld@arch64 programs]$
 
The output expressions have the wrong type. a[i] and a[j] are one
dimentional arrays of type int[4].
 
When passed to the output operator they decay to int* and that address
is displayed. Not the value stored at the address.
 
 
Bo Persson
"James R. Kuyper" <jameskuyper@verizon.net>: Jan 22 09:19AM -0500

On 01/22/2018 08:24 AM, arnuld wrote:
 
> I known from C.7.2 of Stroustrup 3/e that there are no multidimensional
> arrays on hardware level. These dimensions exist in compiler-source only.
> Question is a[i] generally prints the value at \i\. Then why not here ?
 
Because the value at a[i] is an int[4] array. C++ doesn't work directly
with array values; except in certain special cases, "An lvalue or rvalue
of type "array of N T" or "array of unknown bound of T" can be converted
to a prvalue of type "pointer to T". The temporary materialization
conversion (7.4) is applied. The result is a pointer to the first
element of the array." (7.2)
 
The main exceptions to this conversion are the &, typeid (8.2.8p3), and
sizeof (8.3.3p4) operators, direct bindings to references (11.6.3p5),
and when used in discarded-value expressions(8p12). Discarded-value
expressions are expressions that have been converted to void (8.2.9p6),
are the left operand of comma operator (8.19p1), or the entire
expression in an expression statement(9.2).
 
Barry Schwarz <schwarzb@dqel.com>: Jan 22 09:09AM -0800


>I known from C.7.2 of Stroustrup 3/e that there are no multidimensional
>arrays on hardware level. These dimensions exist in compiler-source only.
>Question is a[i] generally prints the value at \i\. Then why not here ?
 
This faulty assumption is at the root of your confusion. When an
expression is evaluated as the operand of an operator, the result is a
value that has a type. Both value and type can be different for
different operators.
 
Consider the case
char c[4] = {5,9,18,3};
char *p = c;
size_t t = sizeof c;
char (*q)[4] = &c;
 
c has type array of four char. p has type pointer to char. t has
type size_t which is an alias for some unsigned integer type. q has
type pointer to array of four char.
 
For purposes of discussion, assume c occupies the four bytes of memory
starting at 0x1000.
 
c is the right operand of the binary operator =. In evaluating the
expression, the compiler uses the general rule that an expression with
type of array of T is converted to an expression of type pointer to T
with the value address of the first array element. Thus p is assigned
the value 0x1000 with type char*.
 
c is the operand of the unary operator sizeof. In evaluating the
expression, the compiler uses the exception to the general rule and
does not perform the conversion. Thus t is assigned the value 4 with
type size_t.
 
c is the operand of the unary operator &. This also is an exception
to the general rule. No conversion is performed and q is assigned
address of the array, value 0x1000 but this time with type (char*)[4].
 
Note that p and q are not equal. They both point to the same spot in
memory but they need not be the same size or even have the same
internal bit representation.
 
In your code, arr has type array of four array of four int. Therefore,
arr[0] is the first array (of four int) in that array of four arrays.
arr[1] is the second such array. arr[2][0] is the first int in the
third array of four int. arr[3][2] is the third int in the fourth
array of four int.
 
When used in an expression of the form
cout << x ....
the << operator is massively overloaded for the various types its
operands can have.
When you code arr[i][j], the compiler will select the overload
version that corresponds to int and you see the value you are
expecting.
When you code arr[i] or arr[j], those expressions have type array
of int and are not exceptions to the general rule. Thus, the
expression is converted and the compiler selects the overload version
that corresponds to int*
 
Except for char*, the overloaded versions of the << operator that deal
with pointers result in the stream containing the address that was
evaluated (similar to %p in printf) and the contents at that address
are ignored. (The peculiar case of char* is used to insert strings,
as C uses that term, and is similar to %s in printf and the contents
at the address are sent to the stream.)
 
 
--
Remove del for email
scott@slp53.sl.home (Scott Lurndal): Jan 22 03:21PM


>It exits with a unix status of 34304=0x8600, indicating abnormal
>termination by signal number of 6, which is SIGABRT. When I said
>"abort", I was being very specific.
 
SIGABRT is never generated by the OS, but rather generated by
the abort(3) and/or raise(3) library functions. In other words,
the application (or one of its libraries) are causing the abort
(perhaps via an assertion failure).
ram@zedat.fu-berlin.de (Stefan Ram): Jan 22 01:48PM

>I known from C.7.2 of Stroustrup 3/e that there are no multidimensional
>arrays on hardware level.
 
I'd say that C++ abstracts from the hardware and also could
run on a machine with multidimensional-arrays "in hardware"
(whatever this might mean). C++ just makes no promises about
this.
 
A 16-bit address can be interpreted as consisting of two 8-bit
indices, one for a row and one for a column. And it is possible
that the memory cells literally are arranged in space this way.
 
A prefetcher can detect an access pattern that ads 0x10 on each
consecutive access and thus could accelerate a read from a "column".
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: