Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Dynamic memory allocation #33

Open
frankhart2018 opened this issue Sep 2, 2020 · 13 comments
Open

[FEATURE] Dynamic memory allocation #33

frankhart2018 opened this issue Sep 2, 2020 · 13 comments
Labels
difficult Difficult problem enhancement New feature or request

Comments

@frankhart2018
Copy link
Member

frankhart2018 commented Sep 2, 2020

Is your feature request related to a problem? Please describe.
Dynamic memory allocation in simC.

Describe the solution you'd like
Open ended, come up with an intuitive syntax.

Note: Discuss syntax with a maintainer before implementing.

@frankhart2018 frankhart2018 added enhancement New feature or request hacktoberfest Part of hacktoberfest labels Sep 2, 2020
@PranshulDobriyal PranshulDobriyal added the difficult Difficult problem label Sep 6, 2020
@cimplec cimplec deleted a comment from viggi-v Oct 15, 2020
@cimplec cimplec deleted a comment from viggi-v Oct 15, 2020
@frankhart2018 frankhart2018 removed the hacktoberfest Part of hacktoberfest label Nov 1, 2020
@dhairyaj dhairyaj added the KWoC'20 These issues are being listed as part of KWoC'20 label Dec 4, 2020
@Gaurav7888
Copy link

@frankhart2018 Hi I want to work upon this issue.
will use malloc for this purpose..

@frankhart2018
Copy link
Member Author

@Gaurav7888 please mention the syntax here, once that is approved I or any other maintainer can assign you to this.

@Gaurav7888
Copy link

Like (pointer type ) malloc(sizeof() )
This is in general syntax gonna use .

@frankhart2018
Copy link
Member Author

DMA includes allocating, reallocating, and deleting.

@Aayush-99 @PranshulDobriyal

@Gaurav7888
Copy link

Gaurav7888 commented Dec 5, 2020

free() could be used for deletion
I just checked out there is something called realloc() for this purpose , i will learn how to use it and apply to solve this issue.
@frankhart2018

@PranshulDobriyal
Copy link
Contributor

@Gaurav7888 What syntax do you propose for the same in SimC ?

@Gaurav7888
Copy link

@PranshulDobriyal cpython have some functions to do abv things .

@PranshulDobriyal
Copy link
Contributor

@Gaurav7888 Yes that will explain the backend of the desired functions, but what front-end (syntax in simC) do you propose.
For ex-
front-end (SimC code) -> print("hello world!!")
back-end - various functions that generate the corresponding C code -> printf("hello world!!");

@Math-O5
Copy link
Collaborator

Math-O5 commented Dec 9, 2020

@Gaurav7888 They are asking for something like:

Example of Sim-C allocating memory:

SimC code:

var i = new int
var j = new int[10]

Generated C code:

int* i = malloc(sizeof(int)); 
int* j = malloc(10*sizeof(int)); 

It's like SimC will interpreter the command.

@Math-O5
Copy link
Collaborator

Math-O5 commented Dec 9, 2020

@frankhart2018 Sim-C should predict the type of the variable? If so, it's change a lot of expected code.

A example.

SimC code:

var i = new var
var j = new var[10]

@victorjzsun
Copy link

What do we need dynamic memory allocation for other than variable length arrays?

@frankhart2018
Copy link
Member Author

Can you start a discussion for this @victorjzsun.

@victorjzsun
Copy link

Created a discussion here

@frankhart2018 frankhart2018 added high priority Needs to be finished ASAP and removed KWoC'20 These issues are being listed as part of KWoC'20 labels Jan 6, 2021
@frankhart2018 frankhart2018 removed the high priority Needs to be finished ASAP label Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficult Difficult problem enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants