Re: Semicolon can be left out after do-while

2011-04-12 Thread Jonathan M Davis
> Timon Gehr: > > I just noticed a little oddity. > > > Why does this code compile? The equivalent C code is rejected: > I think Andrei wants (rightly) it to be fixed. So I think it is an > implementation "bug" that will be fixed. IIRC, TDPL says that the semicolon is required, even though it isn

Re: Questions to template overload resolution

2011-04-12 Thread Jonathan M Davis
> 1) T foo(T:SomeClass)(T arg){..} > It is specified on the main page that this template will match against > instantiations with a subclass of SomeClass. Will this also duplicate the > code? Or will the template work similar to the function T foo(SomeClass > arg){..}? If yes, why should normal fun

Re: Semicolon can be left out after do-while

2011-04-12 Thread spir
On 04/12/2011 11:51 PM, Steven Schveighoffer wrote: On Tue, 12 Apr 2011 17:21:57 -0400, spir wrote: On 04/12/2011 09:21 PM, Steven Schveighoffer wrote: int main(){ int a,b; do{ scanf("%d %d",&a,&b); }while(ahttp://www.digitalmars.com/d/2.0/statement.html#DoStatement) [...] I think the gramma

Re: Semicolon can be left out after do-while

2011-04-12 Thread Steven Schveighoffer
On Tue, 12 Apr 2011 17:21:57 -0400, spir wrote: On 04/12/2011 09:21 PM, Steven Schveighoffer wrote: int main(){ int a,b; do{ scanf("%d %d",&a,&b); }while(aThe grammar specifies this correctly, but then again, the example uses the semicolon. (http://www.digitalmars.com/d

Re: Semicolon can be left out after do-while

2011-04-12 Thread spir
On 04/12/2011 09:21 PM, Steven Schveighoffer wrote: int main(){ int a,b; do{ scanf("%d %d",&a,&b); }while(ahttp://www.digitalmars.com/d/2.0/statement.html#DoStatement) [...] I think the grammar should be changed... yop! This is almost as bad as go's requirement for if sta

Re: Should writef try to statically check for format specifiers?

2011-04-12 Thread Andrej Mitrovic
On 4/12/11, bearophile wrote: > Template functions may not require a bang+types if argument > types can be inferred from the given arguments. So isn't the string literal a candidate in this case?

Questions to template overload resolution

2011-04-12 Thread Timon Gehr
1) T foo(T:SomeClass)(T arg){..} It is specified on the main page that this template will match against instantiations with a subclass of SomeClass. Will this also duplicate the code? Or will the template work similar to the function T foo(SomeClass arg){..}? If yes, why should normal functions and

Re: Should writef try to statically check for format specifiers?

2011-04-12 Thread bearophile
Andrej Mitrovic: > I thought templated functions can be called without a bang if an > argument can be deduced to be available at compile time. I know I've > read about this somewhere, either TDPL or the docs. So I thought that > writef checks the string literal at compile time, not runtime. I thi

Re: Semicolon can be left out after do-while

2011-04-12 Thread Steven Schveighoffer
On Tue, 12 Apr 2011 14:57:26 -0400, Timon Gehr wrote: I just noticed a little oddity. Why does this code compile? The equivalent C code is rejected: import std.stdio; //#include int main(){ int a,b; do{ scanf("%d %d",&a,&b); }while(aThe grammar specifies this correctly, b

Re: Semicolon can be left out after do-while

2011-04-12 Thread bearophile
Timon Gehr: > I just noticed a little oddity. > Why does this code compile? The equivalent C code is rejected: I think Andrei wants (rightly) it to be fixed. So I think it is an implementation "bug" that will be fixed. Bye, bearophile

Semicolon can be left out after do-while

2011-04-12 Thread Timon Gehr
I just noticed a little oddity. Why does this code compile? The equivalent C code is rejected: import std.stdio; //#include int main(){ int a,b; do{ scanf("%d %d",&a,&b); }while(ahttp://www.digitalmars.com/d/2.0/statement.html#DoStatement)

Re: implib

2011-04-12 Thread Jimmy Cao
It's for Windows only.

Re: static variables for non-constant expressions?

2011-04-12 Thread Simon
On 12/04/2011 01:59, Steven Wawryk wrote: On 12/04/11 07:36, Simon wrote: On 11/04/2011 22:15, Stewart Gordon wrote: On 11/04/2011 02:37, Jonathan M Davis wrote: This is true for static "globals" and static members, but the C++ standard requires static locals (local to functions) to be init

Re: Should writef try to statically check for format specifiers?

2011-04-12 Thread Andrej Mitrovic
I thought templated functions can be called without a bang if an argument can be deduced to be available at compile time. I know I've read about this somewhere, either TDPL or the docs. So I thought that writef checks the string literal at compile time, not runtime. Template shenanigans..

implib

2011-04-12 Thread Tine Sukljan
Hi, can anyone tell me where to find implib. I am using mac OS X, but bup.zip have just exe files, which are of no use. Is there a place where I can find implib for mac or unix system? Thanks for the help Tine Å ukljan

Re: Range violation error in the code

2011-04-12 Thread Ishan Thilina
>An array does not dynamically adjust its length when you assign an >element, you have to assign the length explicitly before-hand. Some >dynamic languages do this (like Javascript), but not D. > >You can achieve this with an associative array: > >Node*[int] pointers; > >However, iterating an AA d

strange warning at link-time

2011-04-12 Thread spir
/usr/bin/ld: Warning: size of symbol `_D5table14__T5TableTkTkZ5Table7opApplyMFDFKkZiZi' changed from 96 in /tmp/.rdmd/rdmd-table.d-403917940996C846133B5FCD56447466/table.o to 100 in /tmp/.rdmd/rdmd-table.d-403917940996C846133B5FCD56447466/table.o ??? Note: this is just a warning, program runs

Re: Range violation error in the code

2011-04-12 Thread Ishan Thilina
-Christian Manning wrote: >Seems like Node*[] pointers needs to have a defined length before >allocating to an index as adding "++pointers.length;" before >"pointers[i]=n;" makes it work fine. Thanks, it works...! -Denis wrote: >There is no node in pointers as of now, thus pointers[i] can only b

Re: Range violation error in the code

2011-04-12 Thread Steven Schveighoffer
On Tue, 12 Apr 2011 08:20:20 -0400, Ishan Thilina wrote: I can compile the following code. But when I run the program it gives me a "core.exception.RangeError@untitled(34): Range violation " error. The code is as follows. " import std.stdio; int main(char[][] args) { struct Node

Re: Should writef try to statically check for format specifiers?

2011-04-12 Thread Steven Schveighoffer
On Mon, 11 Apr 2011 16:35:39 -0400, Andrej Mitrovic wrote: There is a bug here: import std.stdio; void main() { int index; writef("The index is", index); } Actually I found this bug in some example code: http://d.puremagic.com/issues/show_bug.cgi?id=5836 writef is missing a forma

Re: Range violation error in the code

2011-04-12 Thread spir
On 04/12/2011 02:20 PM, Ishan Thilina wrote: I can compile the following code. But when I run the program it gives me a "core.exception.RangeError@untitled(34): Range violation " error. The code is as follows. " import std.stdio; int main(char[][] args) { struct Node{

Re: Range violation error in the code

2011-04-12 Thread Christian Manning
On 12/04/2011 13:20, Ishan Thilina wrote: I can compile the following code. But when I run the program it gives me a "core.exception.RangeError@untitled(34): Range violation " error. The code is as follows. " import std.stdio; int main(char[][] args) { struct Node{ int

Range violation error in the code

2011-04-12 Thread Ishan Thilina
I can compile the following code. But when I run the program it gives me a "core.exception.RangeError@untitled(34): Range violation " error. The code is as follows. " import std.stdio; int main(char[][] args) { struct Node{ int _value; Node* _next,_prev,_