Program logic bugs vs input/environmental errors

rst256 via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 20 20:25:54 PDT 2014


On Monday, 20 October 2014 at 20:36:58 UTC, eles wrote:
> On Saturday, 18 October 2014 at 17:40:43 UTC, Walter Bright 
> wrote:
>> On 10/18/2014 8:21 AM, Jacob Carlborg wrote:
>>> On 2014-10-18 07:09, Walter Bright wrote:
>>>
>>>> Which means they'll be program bugs, not environmental 
>>>> errors.
>>>
>>> Yes, but just because I made a mistake in using a function 
>>> (hitting an assert)
>>> doesn't mean I want to have undefined behavior.
>>
>>
>> As I've said before, tripping an assert by definition means 
>> the program has entered an unknown state. I don't believe it 
>> is possible for any language to make guarantees beyond that 
>> point.
>
> What about using the contracts of a fucntion to optimize? They 
> are mainly asserts, after all.
         this(errnoEnforce(.fopen(name, stdioOpenmode),
                         text("Cannot open file `", name, "' in 
mode `",
                                 stdioOpenmode, "'")),
                 name);
making a couple instances of classes not knowing whether they are 
necessary at all, the performance did not cry.
And why do you have all type of cars. Is it really you are so 
good compiler?

> What about using the contracts of a fucntion to optimize? They
Its linking time.
>> is possible for any language to make guarantees beyond that
Of cous no, I will explain later 2-3 hour/ Sorry bisnes
offtop:
	string noexist_file_name = "bag_file_global";
	{writefln("------ begin scope: after");
		auto fobj = File(noexist_file_name);
		scope(failure) writefln("test1.failure");
		scope(exit) writefln("test1.exit");
	}

std.exception.ErrnoException at std\stdio.d(362): Cannot open file 
`bag_...
---------------
5 line with only a memory addr
0x7C81077 in RegisterWaitForInputIdle
i think you need stoped after first errmsg
see exception.d: in constructor or class ErrnoException : 
Exception


More information about the Digitalmars-d mailing list