Comments (3)
ping @MartinNowak can you identify what the purpose of the internal String type is for? I understand you want to be @nogc
, but what is there seems to be totally memory unsafe. I.e. I can slice the string in @safe
code, and then it can be freed and I'm left with a dangling pointer:
@safe unittest {
const(char)[] dangling;
{
String s1;
s1 ~= "hello";
dangling = s1[];
}
writeln(dangling); // uses now-freed memory
}
Edit: is this supposed to be depending on dip1000 to ensure it doesn't compile? I can't get the unittests to build with -dip1000, so maybe that is the intention.
But, reallocation via appending could easily free the original, so there is still that problem.
from io.
Indeed there was some talk about implementing safe nogc strings at that time. So I tried how far scope would work. It had many deficiencies at that time.
Nonetheless this is an internal type that gets us from having a path argument to open a file handle, so it doesn't really matter and gets the job done.
You sure could just push the trusted from this internal type towards those constructors.
from io.
I was more thinking about just using more allocations to avoid memory issues. But I wasn't 100% sure what the different constructors were intended for.
from io.
Related Issues (20)
- Simpler DNS interface needed HOT 5
- Sockets can't be moved HOT 3
- Need a way to close a socket read or write part individually HOT 3
- can't build on windows with dmd 2.086.0 HOT 2
- Provide a EOF function HOT 1
- Add pipe handling.
- Add Unix Socket support
- Add async driver
- Build failure, dmd 2.088: cast from int to void* not allowed in safe code HOT 17
- Add to project tester for dmd HOT 2
- Github pages
- dmd 2.089.0 reports error
- Doc publish authentication doesn't work HOT 1
- Appveyor should be updated to the latest version of DMD
- Drive the accepted socket from a separate thread HOT 7
- Setting SO_NOSIGPIPE on Socket for BSD derivatives HOT 1
- Take ownership unused?
- Add me to AppVeyor controls
- Use with a growing buffer HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from io.