www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How DMD's -w *Prevents* Me From Seeing My Warnings

reply strtr <strtr spam.com> writes:
or: Why does dmd keep on crashing on my code :)
(I blame it on the average D programming; they don't write enough crappy code ) 

After reading the -w post I tried using the -w switch again and it also
prevents me from seeing all my warning, but for a different reason : it crashes
dmd :(

Before crashing a few correct warnings are shown :
warning - tests.d(232): Error: implicit conversion of expression (i1) of type
uint to ubyte can cause loss of data

Somehow I used size_t like this:
struct S {
  ubyte[4] ub;
  void opIndex(size_t i1, size_t i2, size_t i3, size_t i4) {
    ub[0] = i1;
...
}
I have no clue as to why I put size_t there but replacing them with ubyte seems
to fix the crashing problem. 

I can't replicate the crash in something small using only the struct or
something  :(
Somehow it only works when at least twenty modules are imported in (indirectly)
and a lot of them have circular dependencies.
Feb 13 2010
next sibling parent reply daoryn <asd asdf.wqa> writes:
strtr Wrote:

 or: Why does dmd keep on crashing on my code :)
 (I blame it on the average D programming; they don't write enough crappy code
) 
 
 After reading the -w post I tried using the -w switch again and it also
prevents me from seeing all my warning, but for a different reason : it crashes
dmd :(
 
 Before crashing a few correct warnings are shown :
 warning - tests.d(232): Error: implicit conversion of expression (i1) of type
uint to ubyte can cause loss of data
 
 Somehow I used size_t like this:
 struct S {
   ubyte[4] ub;
   void opIndex(size_t i1, size_t i2, size_t i3, size_t i4) {
     ub[0] = i1;
 ...
 }
 I have no clue as to why I put size_t there but replacing them with ubyte
seems to fix the crashing problem. 
 
 I can't replicate the crash in something small using only the struct or
something  :(
 Somehow it only works when at least twenty modules are imported in
(indirectly) and a lot of them have circular dependencies.
 
size_t is the default type to use as index on arrays, since the "length" property of arrays is of size_t. Since you are overloading the Index operator, its only logical the type of the index to be size_t. The code you provided isnt sufficient to help you, since we can't reproduce the bug/problem. Either trim your code to a small example, or paste it at dpaste.com
Feb 13 2010
parent strtr <strtr spam.com> writes:
daoryn Wrote:
 
 size_t is the default type to use as index on arrays, since the "length"
property of arrays is of size_t. Since you are overloading the Index operator,
its only logical the type of the index to be size_t.
 
Ah, luckily this code is not really used as it should be an opcall :)
 The code you provided isnt sufficient to help you, since we can't reproduce
the bug/problem. Either trim your code to a small example, or paste it at
dpaste.com
 
I've tried reducing it, but after a day of failure I really need to go on. Also, I'm not posting the 15 modules of copyrighted code ;)
Feb 13 2010
prev sibling parent Don <nospam nospam.com> writes:
strtr wrote:
 or: Why does dmd keep on crashing on my code :)
 (I blame it on the average D programming; they don't write enough crappy code
) 
 
 After reading the -w post I tried using the -w switch again and it also
prevents me from seeing all my warning, but for a different reason : it crashes
dmd :(
Oh man, you are the Crash Meister!
 
 Before crashing a few correct warnings are shown :
 warning - tests.d(232): Error: implicit conversion of expression (i1) of type
uint to ubyte can cause loss of data
 
 Somehow I used size_t like this:
 struct S {
   ubyte[4] ub;
   void opIndex(size_t i1, size_t i2, size_t i3, size_t i4) {
     ub[0] = i1;
 ...
 }
 I have no clue as to why I put size_t there but replacing them with ubyte
seems to fix the crashing problem. 
 
 I can't replicate the crash in something small using only the struct or
something  :(
 Somehow it only works when at least twenty modules are imported in
(indirectly) and a lot of them have circular dependencies.
 
Feb 14 2010