Hi there,
a silly question from me for the turn of the year... I apparently
missing the forest through the trees.
The first part of the code works as expected:
[code]
int[] arr8 = [1,2,3,4,5];
int sum = 0;
foreach(int summand; arr8)
{
sum += summand;
}
writeln("
Trying to compile this:
void main() @safe
{
import std.stdio;
stdout.flush();
}
Fails with this message:
Error: safe function 'main' cannot access __gshared data
'stdout'
Is this necessary? If so, what are the synchronization
requirements for access to `stdout`?
On Tuesday, 29 December 2015 at 09:26:31 UTC, Alex wrote:
The problem is, that the last line with the reduce does not
compile. Why?
If you get an error, it is imperative that you tell us what it is.
For the record, this code:
import std.bitmanip;
import std.stdio;
impo
V Tue, 29 Dec 2015 17:42:26 +
Alex Parrill via Digitalmars-d-learn
napsáno:
> On Tuesday, 29 December 2015 at 09:26:31 UTC, Alex wrote:
> > The problem is, that the last line with the reduce does not
> > compile. Why?
>
> If you get an error, it is imperative that you tell us what it is.
cpp.cpp:
class Oops {
public:
virtual ~Oops() {}
virtual int number() const { return 42; }
};
Oops* newOops() {
return new Oops;
}
d.d:
import std.stdio;
extern(C++) {
interface Oops {
int number() const;
}
Oops newOops();
}
void main() {
auto oops = new
On Tuesday, 29 December 2015 at 18:32:23 UTC, Atila Neves wrote:
The problem here is that I don't know what the workaround is.
The one I used (well, last time I tried this) was to just put a
dummy function in the D interface that is a placeholder for it.
interface C++Class {
// at the sam
On 12/29/15 4:57 AM, tsbockman wrote:
Trying to compile this:
void main() @safe
{
import std.stdio;
stdout.flush();
}
Fails with this message:
Error: safe function 'main' cannot access __gshared data 'stdout'
Is this necessary? If so, what are the synchronization requirements for
a
Hello, thanks for stopping in. I am fuddling through some
exercises on a certain website, and I have come across a very
frustrating bug I can't seem to fix.
The Problem:
Given a square matrix of size N×N, calculate the absolute
difference between the sums of its diagonals.
Sample Input:
3
1
On Wednesday, 30 December 2015 at 01:36:56 UTC, Michael S wrote:
auto matrix_size = readln;
Change that to
auto matrix_size = readln.strip;
and you should be in business. readln() returns any leading
spaces and the newline character at the end of the line too,
which is why to is throwi
On Wednesday, 30 December 2015 at 01:38:32 UTC, Adam D. Ruppe
wrote:
On Wednesday, 30 December 2015 at 01:36:56 UTC, Michael S wrote:
auto matrix_size = readln;
Change that to
auto matrix_size = readln.strip;
and you should be in business. readln() returns any leading
spaces and the ne
Hi,
Does `pragma(inline, true)` force DMD compiler to inline function
when `-inline` was _not_ defined?
I am failing to get a good disassembled code with obj2asm/otool
:-(
Best, Ilya
11 matches
Mail list logo