On 02/26/2011 01:56 AM, bearophile wrote:
Is this program showing a bug in multiple assignments (DMD 2.052)?
void main() {
int i;
int[2] x;
i, x[i] = 1;
assert(x == [1, 0]); // OK
int j;
int[2] y;
y[j], j = 1;
assert(y == [0, 0]); // Not OK
}
At the
On 02/26/2011 04:26 AM, Steven Schveighoffer wrote:
Let me fix that for you:
func(j++, y[j])
That should be illegal: a statement used as expression, but keeping it's effect
anyway, and not the least kind of, namely an assignment, meaning a change of
the program state.
Denis
--
On Saturday 26 February 2011 00:51:45 spir wrote:
On 02/26/2011 04:26 AM, Steven Schveighoffer wrote:
Let me fix that for you:
func(j++, y[j])
That should be illegal: a statement used as expression, but keeping it's
effect anyway, and not the least kind of, namely an assignment,
Jonathan M Davis jmdavisp...@gmx.com writes:
On Friday, February 25, 2011 17:31:36 Ali Çehreli wrote:
On 02/25/2011 05:09 PM, bearophile wrote:
int j;
int[2] y;
y[j] = j = 1;
I think that's undefined behavior in C and C++. It is not defined
whether j's previous or
On Saturday 26 February 2011 11:18:20 Dan Olson wrote:
Jonathan M Davis jmdavisp...@gmx.com writes:
On Friday, February 25, 2011 17:31:36 Ali Çehreli wrote:
On 02/25/2011 05:09 PM, bearophile wrote:
int j;
int[2] y;
y[j] = j = 1;
I think that's undefined
Is this program showing a bug in multiple assignments (DMD 2.052)?
void main() {
int i;
int[2] x;
i, x[i] = 1;
assert(x == [1, 0]); // OK
int j;
int[2] y;
y[j], j = 1;
assert(y == [0, 0]); // Not OK
}
At the end of the program I expect y to be [1,0] instead of
On 26.02.2011 01:56, bearophile wrote:
Is this program showing a bug in multiple assignments (DMD 2.052)?
void main() {
int i;
int[2] x;
i, x[i] = 1;
assert(x == [1, 0]); // OK
int j;
int[2] y;
y[j], j = 1;
assert(y == [0, 0]); // Not OK
}
At the end
On 02/25/2011 04:56 PM, bearophile wrote:
Is this program showing a bug in multiple assignments (DMD 2.052)?
void main() {
int i;
int[2] x;
i, x[i] = 1;
I haven't heard about multiple assignments but that's the comma operator
up there, separating (and sequencing) two
simendsjo:
I couldn't find any info on the comma expression in the language
reference, but this was my first google hit:
A comma expression contains two operands of any type separated by a
comma and has *left-to-right* associativity. The left operand is fully
evaluated, possibly
On 02/25/2011 05:09 PM, bearophile wrote:
int j;
int[2] y;
y[j] = j = 1;
I think that's undefined behavior in C and C++. It is not defined
whether j's previous or past value is used in y[j].
I would expect the situation be the same in D.
Ali
On Friday, February 25, 2011 17:31:36 Ali Çehreli wrote:
On 02/25/2011 05:09 PM, bearophile wrote:
int j;
int[2] y;
y[j] = j = 1;
I think that's undefined behavior in C and C++. It is not defined
whether j's previous or past value is used in y[j].
I would expect the
On Fri, 25 Feb 2011 21:10:59 -0500, Jonathan M Davis jmdavisp...@gmx.com
wrote:
On Friday, February 25, 2011 17:31:36 Ali Çehreli wrote:
On 02/25/2011 05:09 PM, bearophile wrote:
int j;
int[2] y;
y[j] = j = 1;
I think that's undefined behavior in C and C++. It is not
On Friday, February 25, 2011 19:26:14 Steven Schveighoffer wrote:
On Fri, 25 Feb 2011 21:10:59 -0500, Jonathan M Davis jmdavisp...@gmx.com
wrote:
On Friday, February 25, 2011 17:31:36 Ali Çehreli wrote:
On 02/25/2011 05:09 PM, bearophile wrote:
int j;
int[2] y;
On 02/25/2011 06:10 PM, Jonathan M Davis wrote:
On Friday, February 25, 2011 17:31:36 Ali Çehreli wrote:
On 02/25/2011 05:09 PM, bearophile wrote:
int j;
int[2] y;
y[j] = j = 1;
I think that's undefined behavior in C and C++. It is not defined
whether j's previous or
On Friday 25 February 2011 22:32:47 Ali Çehreli wrote:
On 02/25/2011 06:10 PM, Jonathan M Davis wrote:
On Friday, February 25, 2011 17:31:36 Ali Çehreli wrote:
On 02/25/2011 05:09 PM, bearophile wrote:
int j;
int[2] y;
y[j] = j = 1;
I think that's
15 matches
Mail list logo