"C is just C++ without classes"
ANSI C has not been a subset of C++ since 1999!
- Compound literals
| # purge Gitlab Dependency proxy blobs from the database if the corresponding local file is missing | |
| DependencyProxy::Blob.where(file_store: [nil, ::DependencyProxy::FileUploader::Store::LOCAL]).find_in_batches do |batch| | |
| batch.each { |blob| | |
| begin | |
| blob.open | |
| rescue Errno::ENOENT => e | |
| puts "Blob #{blob.id} corrupted, deleting" | |
| blob.destroy | |
| end | |
| } |
| struct extra_data { | |
| int foo, | |
| int bar, | |
| }; | |
| struct data_type { | |
| const char *str; | |
| struct extra_data *data; | |
| }; |
| #define _CRT_SECURE_NO_WARNINGS | |
| #include <cstdio> | |
| #include <fstream> | |
| #include <iostream> | |
| #include <memory> | |
| #include <string> | |
| template <typename CharT> | |
| class my_basic_fstream : public std::basic_fstream<CharT> { | |
| public: |
Please note that the article is now on my website, and even though I am still working on it, any feedback is appreciated. Thanks for reading !
Back when I did not know anything about programing and started to learn C, I was first introduced to pointers (and other dreaded horrors that made me curl into a corner and cry) and dynamic memory in general.
I was baffled, troubled, yet fascinated by the basic explanation on how memory worked, and started to dread the time where I would need to manually create my char arrays for each and every sentences of my program; right before learning about string literals and feeling like an idiot.
It was then where I was learning about memory allocation and came upon a function that I would call for long the "magic function" : malloc. Magic, because at that point I didn't know how it worked, let alone knew anything about memory other that it was a "chain of boxes for numbers".