Am 07.07.2011 23:23, schrieb nrgyzer:
Hi guys,
I'm trying to read a string from a text file which contains a value of an
enumeration like:
enum MyEnum : string {
Entry_1 = abc,
Entry_2 = def,
Entry_3 = ghi,
}
Stream s = new File(myFile.ext, FileMode.In);
uint len;
s.read(len);
On Thu, 07 Jul 2011 16:23:33 -0400, teo teo.ubu...@yahoo.com wrote:
On Thu, 07 Jul 2011 11:57:51 -0400, Steven Schveighoffer wrote:
Well, I can't really say I understand the point of using this macro at
all. sizeof is a builtin, and part of the C spec. Why not just use
sizeof?
Well, have
OK, good replies. Cool. So the two places I thought I'd need to use
explicit types are in parameter and return types. Say, a function returns
the result of map, and another consumes it to print it. The consuming
function seems to work with templating:
void printSquares(T)(T squares) {
On Fri, Jul 8, 2011 at 4:06 PM, James Fisher jameshfis...@gmail.com wrote:
So ... stuff works, but I'm not really sure why one uses function
templating and the other uses return type inference. Any answers?
... Wait, brain malfunction; I think I do understand. The type is inferable
purely
On Fri, 08 Jul 2011 11:08:14 -0400, James Fisher jameshfis...@gmail.com
wrote:
On Fri, Jul 8, 2011 at 4:06 PM, James Fisher jameshfis...@gmail.com
wrote:
So ... stuff works, but I'm not really sure why one uses function
templating and the other uses return type inference. Any answers?
On Fri, Jul 8, 2011 at 4:49 PM, Steven Schveighoffer schvei...@yahoo.comwrote:
On Fri, 08 Jul 2011 11:08:14 -0400, James Fisher jameshfis...@gmail.com
wrote:
On Fri, Jul 8, 2011 at 4:06 PM, James Fisher jameshfis...@gmail.com
wrote:
So ... stuff works, but I'm not really sure why one
This is just an observation, not a question or anything.
void main()
{
enum width = 100;
double step = 1 / width;
writeln(step); // 0
}
I've just had this bug in my code. I forgot to make either width or 1
a floating-point type. IOW, I didn't do this:
void main()
{
enum width
On 7/9/11, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
double step = 1 / width; // or .1
Woops that should have been `1.`. See, another bug right there!
On Fri, 08 Jul 2011 18:47:55 -0400, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
On 7/9/11, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
double step = 1 / width; // or .1
Woops that should have been `1.`. See, another bug right there!
1.0
1. is a horrible legacy thing,
On 7/9/11, Steven Schveighoffer schvei...@yahoo.com wrote:
On Fri, 08 Jul 2011 18:47:55 -0400, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
On 7/9/11, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
double step = 1 / width; // or .1
Woops that should have been `1.`. See,
Andrej Mitrovic:
enum width = 100;
double step = 1 / width;
...
This seems like a very easy mistake to make.
Right, it was present even in Python 2.x:
http://ideone.com/BEZqq
The bug you have found is common enough to deserve a so fundamental change in
Python, they have improved it
On Fri, 08 Jul 2011 18:45:58 -0400, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
This is just an observation, not a question or anything.
void main()
{
enum width = 100;
double step = 1 / width;
writeln(step); // 0
}
I've just had this bug in my code. I forgot to make
12 matches
Mail list logo