This piqued my interest, as I've never heard of this.
The manpage is here: https://www.freebsd.org/cgi/man.cgi?query=malloc&sektion=9&manpath=FreeBSD+7.0-RELEASE
The flags are interesting. Especially the M_ZERO flag.
The type information is used for memory profiling and accounting, it doesn't really appear to be a different malloc underneath. https://www.safaribooksonline.com/library/view/freebsd-device-drivers/9781457166716/ch02s02.html
Have you tried IntelliJ IDEA from Jet Brains?
https://www.jetbrains.com/idea/
If you have an .edu account you can pick up the full version for free, otherwise there is a free community edition.
https://www.jetbrains.com/student/
Jetbrains makes reSharper, which is a godsend to Visual Studio. I haven't tried IntelliJ, but I can only expect good things out of them. Definitely worth checking out.
Thanks for the post! Do you have experience with Atom? I've been using this one a while. Any reason for my coworkers and I to consider VSCode over Atom or even vim for a Python/C developer?
But actually
Yes that's because for legacy reasons bool is an integer. (A believe people were making their own True/False before there were official ones with 0/1).
The language designers did consider this Pythonic and thought using bool like this was fine
https://stackoverflow.com/questions/3174392/is-it-pythonic-to-use-bools-as-ints
I, despite being a much less skilled developer, heavily disagree and recommend never doing this. If you have to use a dictionary instead.
A quick search found this: https://stackoverflow.com/questions/16658087/automatically-add-gitignore-and-hooks-on-git-init
I hadn't ever thought about this. I'll definitely set this up for my own purposes.
An interesting use of fragments and the fact that they're not sent to the server is something like this project, that uses the fragment to hold the cryptographic keys for data it stores: http://sebsauvage.net/wiki/doku.php?id=php:zerobin
There are a few options...I don't think interfaces are the way to go though. One option would be to just make a "nullable container" a special type in the language, like Optional<T> or Haskell's Maybe. Or you do what Kotlin and other languages do, and have a flag you put on the type: String is not nullable, but String? is. The approaches aren't that different, mostly syntactical.
To get what I'm talking about, take a look at Kotlin's introduction to null safety (disclaimer; I've never done more than toy with Kotlin so I'm not really qualified to endorse that approach--but I really like it at a glance).
Rather than saying it and the other gamification learning sites teach you to be a "bad" developer, I would instead say it doesn't teach you everything you need to know to be a "complete" developer. But it is useful for refining some components of being a good developer, namely familiarity with different data structures, algorithms, language idioms, and how to work/think through a particularly thorny problem.
For example right now I'm working on a problem that requires efficiently generating primes as part of the solution. My early solutions were timing out because I wasn't caching/pre-calculating values. That's an important thing to remember to do for computationally expensive problems (time/space trade-off), and this particular problem was a good refresher of that for me.
But for sure I would agree a complete developer needs sound software engineering chops as well, and the gamification sites won't get you that.
Here's that problem if you're curious: https://www.hackerrank.com/challenges/alice-and-bobs-silly-game/problem
I remember they had a section for 'cracking the coding interview' (2 years ago). They had videos and everything walking over the answers.
Seems they reworked it into this. https://www.hackerrank.com/interview/interview-preparation-kit
It can be very useful for things like Lua (or really any other situation which allocates and gives you memory that you have to use, rather than allowing you to use your own). In Lua, you can create a userdata and associate a destructor to it. In this case, if you want to make a C++ object as a userdata, your good choices are
There are upsides and downsides to both. For 1, you have to make sure the allocator you want is what you're getting, as lua might be more efficient at working with its memory. It's also a simpler model with less indirection, and leaves the deallocation and allocation work entirely to Lua. For 2, you can't be sure that the heap isn't touched unless you know the whole composition and call stack of the object. The destructor is also not guaranteed to be called prior to Lua 5.2 (5.2 has a clause guaranteeing finalizers all get called), so for 1 you may leak memory, but 2 you still might leak a bit of memory from uncalled destructors.
It's about knowing what you're doing and knowing the proper semantics. There are countless sane cases for placement new, as with any other functionality. Placement new is pretty much for "if I need to create an object on memory that I already have and can't or don't want to change the creation of". Use placement new if there is no better method of doing what you want to do. It's a tool, and as always, you should use the best tool for the job.