What is the right idiom for testing that a function call does segfault
when you want it to?
--
Russel.
=
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465
On Thursday, December 06, 2012 09:02:29 Russel Winder wrote:
What is the right idiom for testing that a function call does segfault
when you want it to?
Why would you _want_ a function to segfault? That's like asking how to write a
function which tests that a computer is off after you pull the
On 06-12-2012 11:31, Jonathan M Davis wrote:
On Thursday, December 06, 2012 09:02:29 Russel Winder wrote:
What is the right idiom for testing that a function call does segfault
when you want it to?
Why would you _want_ a function to segfault? That's like asking how to write a
function which
Jesse Phillips:
It seems to be similar to that of std.typecons.Nullable with
the following differences.
Recently I've written something about Nullable:
http://d.puremagic.com/issues/show_bug.cgi?id=9086
Bye,
bearophile
Currently this code is not supported:
void foo(T)(T x, T function(T) f) {}
void main() {
foo(1, (int a) = a * a); // OK
foo(1, a = a * a); // Error
}
With the latest alpha compiler it gives:
test.d(4): Error: template test.foo does not match any function
template declaration.
On Thursday, 6 December 2012 at 13:04:05 UTC, bearophile wrote:
Currently this code is not supported:
void foo(T)(T x, T function(T) f) {}
void main() {
foo(1, (int a) = a * a); // OK
foo(1, a = a * a); // Error
}
With the latest alpha compiler it gives:
test.d(4): Error:
Maxim Fomin:
The second is template lambda and templates have void type.
What you suggest here?
In D template functions become functions if they are passed where
the D compiler can infer their full type. This is correct code:
void foo(int function(int) f) {}
void main() {
foo(a = a *
On Thursday, 6 December 2012 at 13:04:05 UTC, bearophile wrote:
Currently this code is not supported:
void foo(T)(T x, T function(T) f) {}
void main() {
foo(1, (int a) = a * a); // OK
foo(1, a = a * a); // Error
}
I forgot there is int here, so T in lambda should be deduced as
I am trying to create simple app that would read user input and
open file with such name, but every time when I run it's crash
with error
std.file.FileException@std\file.d(294): \1.txt
import std.stdio;
import std.string;
import std.file;
void main()
{
string getfilename()
{
On Thu, 06 Dec 2012 01:26:32 -, Sam Hu samhudotsa...@gmail.com wrote:
Known issues:
Under console reading Access table recordsets works fine ,inserting a
new record which contains only English characters works fine as well,but
inserting new record which contains Chinese character will
I don't know where that cast occurs but I wanted to state the
obvious: Operator ~ is defined only for arrays.
Would having it also work for individual units to make an array
be a plausible enhancement request? It would seem like a natural
use of the operator.
Philippe Sigaud:
Doesn't that mean you're asking the compiler to have a full
unification
engine? Your example is simple, but the general case is more
complicated:
I think the general case doesn't require a whole program type
inference, just a local one. But maybe it's too much complex to
On 12/06/2012 07:52 AM, Suliman wrote:
I am trying to create simple app that would read user input and open
file with such name, but every time when I run it's crash with error
std.file.FileException@std\file.d(294): \1.txt
import std.stdio;
import std.string;
import std.file;
void main()
{
Suliman:
I am trying to create simple app that would read user input and
open file with such name, but every time when I run it's crash
with error
std.file.FileException@std\file.d(294): \1.txt
Try to declutter your code as much as possible, then print the
file name before trying to call
I had put next try-catch block yo my code
void readfile(string name)
{
try
{
auto filearray = read(name);
writeln(name);
writeln(filearray);
I am learning D classes and I am getting error when I am try to
make instance of class. erorr:
C:\code\main.d(9): Error: constructor
GetFileName.GetFileName.this (string name) is not callable using
argument types ()
http://www.everfall.com/paste/id.php?xie09xz9upth
On 2012-12-06, 20:17, Suliman wrote:
I am learning D classes and I am getting error when I am try to make
instance of class. erorr:
C:\code\main.d(9): Error: constructor GetFileName.GetFileName.this
(string name) is not callable using argument types ()
Am I right that my variant of code would be valid for C#?
How can I assign value to name in such manner?
When I should use keyword this?
I dropped it from my class and now I can make instance of class
without in sych way:
auto file = new GetFileName();
file.name = test;
On 12/06/2012 12:08 PM, js.mdnq wrote:
On Thursday, 6 December 2012 at 03:22:55 UTC, Ali Çehreli wrote:
The following comment is relevant:
/* Although this can be a polymorphic type, I am assuming that all of
the edge
* handlers will produce the same type of result. */
struct
On Wednesday, 5 December 2012 at 00:10:30 UTC, Jesse Phillips
wrote:
This article goes over a Nullable/Optional/Maybe implementation
for C#.
http://twistedoakstudios.com/blog/Post1130_when-null-is-not-enough-an-option-type-for-c
Ok so I have the need to make a static library that will be
reused in multiple future projects. My thinking was that in
future solutions i can just add an existing project, my static
library project, so it would grab it and just work. However i
cannot seem to get it to work.
I have a
On 06.12.2012 22:03, Nekroze wrote:
Ok so I have the need to make a static library that will be reused in
multiple future projects. My thinking was that in future solutions i can
just add an existing project, my static library project, so it would
grab it and just work. However i cannot seem
On 2012-12-06, 20:48, Suliman wrote:
When I should use keyword this?
I dropped it from my class and now I can make instance of class without
in sych way:
auto file = new GetFileName();
file.name = test;
Indeed. If you have not defined a constructor, the language defines one
for you, which
On Thursday, 6 December 2012 at 21:28:38 UTC, Rainer Schuetze
wrote:
On 06.12.2012 22:03, Nekroze wrote:
Ok so I have the need to make a static library that will be
reused in
multiple future projects. My thinking was that in future
solutions i can
just add an existing project, my static
On 06.12.2012 23:00, Nekroze wrote:
On Thursday, 6 December 2012 at 21:28:38 UTC, Rainer Schuetze wrote:
On 06.12.2012 22:03, Nekroze wrote:
Ok so I have the need to make a static library that will be reused in
multiple future projects. My thinking was that in future solutions i can
just
On Thursday, 6 December 2012 at 22:06:43 UTC, Rainer Schuetze
wrote:
On 06.12.2012 23:00, Nekroze wrote:
On Thursday, 6 December 2012 at 21:28:38 UTC, Rainer Schuetze
wrote:
On 06.12.2012 22:03, Nekroze wrote:
Ok so I have the need to make a static library that will be
reused in
multiple
On 06.12.2012 23:14, Nekroze wrote:
On Thursday, 6 December 2012 at 22:06:43 UTC, Rainer Schuetze wrote:
On 06.12.2012 23:00, Nekroze wrote:
On Thursday, 6 December 2012 at 21:28:38 UTC, Rainer Schuetze wrote:
On 06.12.2012 22:03, Nekroze wrote:
Ok so I have the need to make a static
On Thursday, 6 December 2012 at 22:26:07 UTC, Rainer Schuetze
wrote:
On 06.12.2012 23:14, Nekroze wrote:
On Thursday, 6 December 2012 at 22:06:43 UTC, Rainer Schuetze
wrote:
On 06.12.2012 23:00, Nekroze wrote:
On Thursday, 6 December 2012 at 21:28:38 UTC, Rainer
Schuetze wrote:
On
On Thursday, 6 December 2012 at 16:44:01 UTC, Regan Heath wrote:
On Thu, 06 Dec 2012 01:26:32 -, Sam Hu
samhudotsa...@gmail.com wrote:
Known issues:
Under console reading Access table recordsets works fine
,inserting a new record which contains only English characters
works fine as
On Thu, 06 Dec 2012 16:52:20 +0100, Suliman wrote:
I am trying to create simple app that would read user input and open
file with such name, but every time when I run it's crash with error
std.file.FileException@std\file.d(294): \1.txt
After a call to readln, the string returned has
On 12/06/2012 10:39 PM, ollie wrote:
On Thu, 06 Dec 2012 16:52:20 +0100, Suliman wrote:
I am trying to create simple app that would read user input and open
file with such name, but every time when I run it's crash with error
std.file.FileException@std\file.d(294): \1.txt
After a call to
32 matches
Mail list logo