www.digitalmars.com         C & C++   DMDScript  

D - bug: assoc arrays by structs

reply "Carlos Santander B." <carlos8294 msn.com> writes:
The following doesn't link:

struct A {}
void main() {
        int [A] w;
        A a;
        w[a]=8;
}

Outputs: Error 42: Symbol Undefined __init_14TypeInfo_S1x1A.

-------------------------
Carlos Santander


---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 2003-10-16
Oct 20 2003
parent reply "Walter" <walter digitalmars.com> writes:
"Carlos Santander B." <carlos8294 msn.com> wrote in message
news:bn182h$qup$1 digitaldaemon.com...
 The following doesn't link:

 struct A {}
 void main() {
         int [A] w;
         A a;
         w[a]=8;
 }

 Outputs: Error 42: Symbol Undefined __init_14TypeInfo_S1x1A.
Yes. It needs a typeinfo class for it to work. Unfortunately, I haven't figured out a way for this to work for user defined types. To make it work for now, you'll need to write one, see the ti_*.d files in phobos for reference. They're pretty simple.
Oct 22 2003
next sibling parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
"Walter" <walter digitalmars.com> wrote in message
news:bn5ee6$2cfd$1 digitaldaemon.com...
|
| Yes. It needs a typeinfo class for it to work. Unfortunately, I haven't
| figured out a way for this to work for user defined types. To make it work
| for now, you'll need to write one, see the ti_*.d files in phobos for
| reference. They're pretty simple.
|
|

But the same works if A is a class instead of a struct.

—————————————————————————
Carlos Santander


---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 2003-10-16
Oct 22 2003
parent "Walter" <walter digitalmars.com> writes:
"Carlos Santander B." <carlos8294 msn.com> wrote in message
news:bn65s2$9re$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> wrote in message
 news:bn5ee6$2cfd$1 digitaldaemon.com...
 |
 | Yes. It needs a typeinfo class for it to work. Unfortunately, I haven't
 | figured out a way for this to work for user defined types. To make it
work
 | for now, you'll need to write one, see the ti_*.d files in phobos for
 | reference. They're pretty simple.
 |
 |

 But the same works if A is a class instead of a struct.
Right. That's because a class has the several predefined virtual functions needed.
Jan 28 2004
prev sibling parent reply "Sean L. Palmer" <palmer.sean verizon.net> writes:
What is the difference between a TypeInfo and a ClassInfo?

Sean

"Walter" <walter digitalmars.com> wrote in message
news:bn5ee6$2cfd$1 digitaldaemon.com...
 "Carlos Santander B." <carlos8294 msn.com> wrote in message
 news:bn182h$qup$1 digitaldaemon.com...
 The following doesn't link:

 struct A {}
 void main() {
         int [A] w;
         A a;
         w[a]=8;
 }

 Outputs: Error 42: Symbol Undefined __init_14TypeInfo_S1x1A.
Yes. It needs a typeinfo class for it to work. Unfortunately, I haven't figured out a way for this to work for user defined types. To make it work for now, you'll need to write one, see the ti_*.d files in phobos for reference. They're pretty simple.
Oct 22 2003
parent reply "Walter" <walter digitalmars.com> writes:
"Sean L. Palmer" <palmer.sean verizon.net> wrote in message
news:bn6cdp$imr$1 digitaldaemon.com...
 What is the difference between a TypeInfo and a ClassInfo?
TypeInfo gives information on any type, ClassInfo just for classes.
Jan 28 2004
parent "Sean L. Palmer" <palmer.sean verizon.net> writes:
This seems like an implementation detail that has leaked out.

Sean

"Walter" <walter digitalmars.com> wrote in message
news:bva2mu$3198$2 digitaldaemon.com...
 "Sean L. Palmer" <palmer.sean verizon.net> wrote in message
 news:bn6cdp$imr$1 digitaldaemon.com...
 What is the difference between a TypeInfo and a ClassInfo?
TypeInfo gives information on any type, ClassInfo just for classes.
Jan 29 2004