The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Linked list
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

srmcarneir

Brazil
33 Posts

Posted - 03/31/2003 :  4:40:25 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I need to create strings dynamically and thought of encapsulating it in a structure and accessing that thru a linked list like this:

struct MyStruct {
string strMyString;
} MyStructure, *ptFirstMyStruct, *ptThisMyStruct;

Then I thought of using malloc and free to allocate memory dynamically as follows:

ptFirstMyStruct = (struct MyStruct *) malloc (sizeof
( struct MyStruct));

. . .

free ((void *) ptFirstMyStruct);

But OriginC compilator sent me an exception of "Integer divided by zero", when I was building. That crashed and finished the whole Origin application.

Is there any special attention to be paid to compilation time when using malloc/free functions? In fact I am a beginner at using these functions and probably my doubts concern of basic concepts on that...

[By the way, does OriginC support C++ routines?]

Best Wishes,

Ricardo Carneiro

cpyang

USA
1406 Posts

Posted - 04/01/2003 :  09:23:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
[By the way, does OriginC support C++ routines?]




Not sure what you are looking for. Origin C in Origin 7 does not support C++ but next version of Origin (Origin 8) will have substantial support of C++. There is also going to be an XML based Tree built-in to the language then, so that making a linked list would
be a very simple matter.


CP


Go to Top of Page

srmcarneir

Brazil
33 Posts

Posted - 04/01/2003 :  5:59:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Great News about next version of Origin, Mr. Yang!
That will enhance the tool substantially.

In the meantime I guess I will live with some static allocation
because the events in case are kind of predictable.
I was just trying to improve my code. Best Regards!

Ricardo Carneiro
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000