🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by cohler Mon, 07 Jul 1986 20:42
Arrays of Classes
#247
Author: cohler
Date: Mon, 07 Jul 1986 20:42
43 lines
1760 bytes
     Machine : c++ on vax/750 running BSD 4.2

     a Bug ?

        We have encountered a problem with allocating storage for
    arrays of classes. Looking at the generated c code it seems
    that 'new' forgets to cast '_vec_new()'. Has anyone else
    had similar problems ?

        The following code illustrates the problem - which 
    goes away by compiling with -DBUGFIX.

        Also complex.h does not have a default constructor -
    so arrays of complex numbers cant be defined at all - this
    of course can be fixed by providing a default constructor
    in complex.h. 


    Gene Cohler                 cohler@lnsvax.tn.cornell.EDU 
    Newman Lab, Cornell Univ    jbvy@cornella.BITNET
    Ithaca NY 14853-5001        {decvax,ihnp4,cmcl2,vax135}
                                !cornell!lnsvax!cohler
    
======================= source code ======================
// tst.c -> Arrays of classes ?
class test
    {
    public:
        int i1;
        int i2;
        test(){i1 = 0; i2 = 0;}
    };

main()
    {
    test *t1    ;
#ifdef BUGFIX
        t1 = (struct test *) new test[10]   ;
#else
        t1 = new test[10]   ;
#endif BUGFIX
    }
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads