From: Demetris Z. <fgc...@cy...> - 2007-11-30 12:10:30
|
I finally made it work The code actually would be: float (*RegionData)[BLOBDATACOUNT]=malloc(BLOBTOTALCOUNT*BLOBDATACOUNT*sizeof(floa t)); // Blob result array yeppyy, it works :)) -----Original Message----- From: gum...@li... [mailto:gum...@li...] On Behalf Of Tim Redfern Sent: Friday, November 30, 2007 1:31 PM To: General mailing list for gumstix users. Subject: Re: [Gumstix-users] C++ & C question Hi its hard to know without seeing the whole thing and I don't really claim to be a programmer! But I think it would be like this: float *Regiondata; Regiondata = malloc(BLOBTOTALCOUNT*BLOBTOTALCOUNT*sizeof(float)); which you would of course have to free() explicitly when you were finished. I think you should read this: http://vergil.chemistry.gatech.edu/resources/programming/c-tutorial/dynamic. html Tim >But how would this line look in C ? > >float (*RegionData)[BLOBDATACOUNT]=new >float[BLOBTOTALCOUNT][BLOBDATACOUNT]; // Blob result array > >-----Original Message----- >From: gum...@li... >[mailto:gum...@li...] On Behalf Of Tim >Redfern >Sent: Friday, November 30, 2007 1:03 PM >To: General mailing list for gumstix users. >Subject: Re: [Gumstix-users] C++ & C question > >Hi Demitris, I think it would look like this in C: > >int* >WorkingStorage=(int*)malloc((BLOBROWCOUNT+2)*(BLOBCOLCOUNT+2)*sizeof(int)); > > > > > >>I have only a couple of functions that are not recognized >> >>The one is: >> >>int* WorkingStorage = new int[(BLOBROWCOUNT+2)*(BLOBCOLCOUNT+2)];// Working >>storage. Note +2 +2 >> >>So in C it would look like this: >> >>int* WorkingStorage = int((BLOBROWCOUNT+2)*(BLOBCOLCOUNT+2));// Working >>storage. Note +2 +2 >> >> >>Correct ? >> >>So then how would this one look in C: >> >>float (*RegionData)[BLOBDATACOUNT] = new >>float[BLOBTOTALCOUNT][BLOBDATACOUNT]; // Blob result array >> >>? >> >> >> >>-----Original Message----- >>From: gum...@li... >>[mailto:gum...@li...] On Behalf Of Steve >>Bavalis >>Sent: Friday, November 30, 2007 11:32 AM >>To: General mailing list for gumstix users. >>Subject: Re: [Gumstix-users] C++ & C question >> >>Not very well. C++ is a super set of C so it can contain C code. If your >>C++ library uses only C calls you could possibly recompile it as C, but >>then it probably would have been C to begin with. Your best bet would be >>to recompile your code as C++. >> >>Demetris Zavorotnichenko wrote: >> >> >> >> >>>Hi everyone. >>> >>>I have a programming question, it's gonna sound pretty stupid but bare >>> >>> >>> >>> >>with >> >> >> >> >>>me. >>> >>>I have my code written and compiled with C >>> >>>And I have a library which is written in C++ >>> >>>My question is: Can I compile C++ code with C ? >>> >>> >>>------------------------------------------------------------------------- >>>SF.Net email is sponsored by: The Future of Linux Business White Paper >>> >>> >>>from Novell. From the desktop to the data center, Linux is going >> >> >>>mainstream. Let it simplify your IT future. >>>http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 >>>_______________________________________________ >>>gumstix-users mailing list >>>gum...@li... >>>https://lists.sourceforge.net/lists/listinfo/gumstix-users >>> >>> >>> >>> >>> >>------------------------------------------------------------------------- >>SF.Net email is sponsored by: The Future of Linux Business White Paper >> >> >>from Novell. From the desktop to the data center, Linux is going > > >>mainstream. Let it simplify your IT future. >>http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 >>_______________________________________________ >>gumstix-users mailing list >>gum...@li... >>https://lists.sourceforge.net/lists/listinfo/gumstix-users >> >> >>------------------------------------------------------------------------- >>SF.Net email is sponsored by: The Future of Linux Business White Paper >> >> >>from Novell. From the desktop to the data center, Linux is going > > >>mainstream. Let it simplify your IT future. >>http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 >>_______________________________________________ >>gumstix-users mailing list >>gum...@li... >>https://lists.sourceforge.net/lists/listinfo/gumstix-users >> >> >> >> > > >------------------------------------------------------------------------- >SF.Net email is sponsored by: The Future of Linux Business White Paper >from Novell. From the desktop to the data center, Linux is going >mainstream. Let it simplify your IT future. >http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 >_______________________________________________ >gumstix-users mailing list >gum...@li... >https://lists.sourceforge.net/lists/listinfo/gumstix-users > > >------------------------------------------------------------------------- >SF.Net email is sponsored by: The Future of Linux Business White Paper >from Novell. From the desktop to the data center, Linux is going >mainstream. Let it simplify your IT future. >http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 >_______________________________________________ >gumstix-users mailing list >gum...@li... >https://lists.sourceforge.net/lists/listinfo/gumstix-users > > ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ gumstix-users mailing list gum...@li... https://lists.sourceforge.net/lists/listinfo/gumstix-users |