Paolo Invernizzi , dans le message (digitalmars.D.learn:29680), a
écrit :
--Apple-Mail-7--919646864
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
Hi all,=20
I've found nothing on bugzilla for that, what I'm missing? Or it's a =
bug? (DMD
import std.stdio;
immutable HELLO = hello;
void main() {
auto string = hello;
switch(string) {
case HELLO:
writeln(hello);
break;
default:
writeln(unknown);
break;
}
}
testCase.d(7): Error: case must be a
If immutable cannot be used, what else can be used to replace #define
in C?
Thanks a lot.
immutables are runtime constants. For case you need a
compile time constant, which you can define with enum.
enum string mycase = value;
Thank you all very much.
Paolo
On Sep 22, 2011, at 7:12 PM, Jonathan M Davis wrote:
On Thursday, September 22, 2011 04:12 Paolo Invernizzi wrote:
The error is a bit confusing but essentially correct. Bar has an immutable
member variable. Once it's been initialized, that immutable member
Jesse Phillips jessekphillip...@gmail.com wrote in message
news:j5gfsa$2d5g$1...@digitalmars.com...
Thank you this lets it compile. I think I had that somewhere, but forgot
about it. As Steve mentions, it probably should also work for const
arguments too.
It probably will, eventually. Some
On Thu, 22 Sep 2011 22:18:29 +0100, Jonathan M Davis jmdavisp...@gmx.com
wrote:
On Thursday, September 22, 2011 14:10 Steven Schveighoffer wrote:
No, the parameter types can be const, and can accept mutable arguments.
The main point is, the return value has to be proven to be *unique*. The
On Friday, September 23, 2011 01:38 Tobias Pankrath wrote:
If immutable cannot be used, what else can be used to replace #define
in C?
Thanks a lot.
immutables are runtime constants. For case you need a
compile time constant, which you can define with enum.
enum string mycase =
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload from immutable as in C++?
test2.d
Description: Binary data
On Friday, September 23, 2011 23:19:15 so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload from immutable as in C++?
That compiles fine with the lastest dmd from git. Is it
On Fri, 23 Sep 2011 16:19:15 -0400, so s...@so.so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload from immutable as in C++?
example? I'm afraid I don't really understand the
I'm working on an application that requires a large number of strings that only
need to be loaded once at runtime and need to be accessible to all threads
throughout the execution of the program. Some of these strings are variables
like database host and username that need to be read from a
On Friday, September 23, 2011 13:29:08 Jonathan Crapuchettes wrote:
I'm working on an application that requires a large number of strings that
only need to be loaded once at runtime and need to be accessible to all
threads throughout the execution of the program. Some of these strings are
On Fri, 23 Sep 2011 23:27:02 +0300, Jonathan M Davis jmdavisp...@gmx.com
wrote:
On Friday, September 23, 2011 23:19:15 so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload
On Fri, 23 Sep 2011 16:27:23 -0400, Steven Schveighoffer
schvei...@yahoo.com wrote:
On Fri, 23 Sep 2011 16:19:15 -0400, so s...@so.so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable
On Fri, 23 Sep 2011 16:35:59 -0400, so s...@so.so wrote:
On Fri, 23 Sep 2011 23:27:02 +0300, Jonathan M Davis
jmdavisp...@gmx.com wrote:
On Friday, September 23, 2011 23:19:15 so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational
On Fri, 23 Sep 2011 23:44:52 +0300, Steven Schveighoffer
schvei...@yahoo.com wrote:
steves@steve-laptop:~/testd$ cat testconst.cpp
#include iostream
using namespace std;
struct S {
S fun() {
cout fun endl;
return *this;
}
S fun() const {
cout
On Fri, 23 Sep 2011 23:44:41 +0300, Jonathan M Davis jmdavisp...@gmx.com
wrote:
It uses the const version if the struct or class is const. And in
neither case
in your program is it const. It's mutable in both, so the mutable
overload is
the one that gets called in both places. Why would
O... So I if it is in my main function (which I think it is) I should move
it
out? That makes sense... Thank you Timon!!
Hi folks,
I wasn't sure whether this should go here or in the D devel list...
I'm trying to port a program where threads read from a file, process the data,
then write the output data. The program is cpu-bound. In C++ I can do
something like this:
class QueueIn {
ifstream in;
mutex m;
On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote:
Hi folks,
I wasn't sure whether this should go here or in the D devel list...
I'm trying to port a program where threads read from a file, process the
data, then write the output data. The program is cpu-bound. In C++ I can
do
Jonathan M Davis Wrote:
On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote:
A direct rewrite would involve using shared and synchronized (either on the
class or a synchronized block around the code that you want to lock).
However,
the more idiomatic way to do it would be to use
21 matches
Mail list logo