Dynamic Array basics in C++
Dynamic Array basics in C++
C++OnSea 2025 SESSION ANNOUNCEMENT: Smart Pointers, Dumb Mistakes by Khushboo Verma
https://cpponsea.uk/2025/session/smart-pointers-dumb-mistakes
Register now at https://cpponsea.uk/tickets/
C++OnSea 2025 SESSION ANNOUNCEMENT: Smart Pointers, Dumb Mistakes by Khushboo Verma
https://cpponsea.uk/2025/session/smart-pointers-dumb-mistakes
Register now at https://cpponsea.uk/tickets/
I would claim that I'm *very* experienced with #programming in #C. But still, C gets annoyingly weird when it comes to #pointers *to* #arrays.
Does the following code look sober to you? (My compiler doesn't complain)
Especially interested in the highlighted line, but also the block above trying to expand the array ...
Context: I started work on a generic/configurable rate-limiter to add to #swad.
I would claim that I'm *very* experienced with #programming in #C. But still, C get's annoyingly weird when it comes to #pointers *to* #arrays.
Does the following code look sober to you? (My compiler doesn't complain)
Especially interested in the highlighted line, but also the block above trying to expand the array ...
Context: I started work on a generic/configurable rate-limiter to add to #swad.
TIL: C array subscript operators are handled in such a way that `letters[i]` is equivalent to `*(letters + i)` and because addition is commutative, that expression is identical to `*(i + letters)`, which means that `i[letters]` is the same as `letters[i]`.
```
#include <stdio.h>
#include <stddef.h>
int main() {
char letters[3] = "abc";
size_t i = 2;
printf("letters: %p\n", (void *)&letters);
printf("i[letters] (%p): %c\n", (void*)&(i[letters]), i[letters]);
printf("letters[i] (%p): %c\n", (void*)&(letters[i]), letters[i]);
return 0;
}
```
Which outputs:
```
letters: 0x7ffc68ec7bb9
i[letters] (0x7ffc68ec7bbb): c
letters[i] (0x7ffc68ec7bbb): c
```
Mind blown...
#til #clang #pointers #programming
Falsehoods programmers believe about null pointers
https://purplesyringa.moe/blog/falsehoods-programmers-believe-about-null-pointers/
Discover the Unique World of PUNKX.org Card Games
PUNKX.org is a hub for intellectually stimulating and entertaining card games, perfect for those who love programming, problem-solving, or just a good challenge.
Read More: https://machaddr.substack.com/p/discover-the-unique-world-of-punkxorg
Three Libraries for the Python-kings under the ML sky,
Seven for the C++-lords in their halls of hackerone,
Nine for Mortal Frontenders doomed to DROP BY,
One libc on his dark throne;
In the Land of Pointers where the void * lie.
One Library to rule them all, one Library to find them,
One Library to bring them all, and in the pointer arithmetics bind them;
In the Land of Pointers where the void * lie.
no matter how many docs I read, no matter how many stackoverflow/reddit/whatever posts I read, no matter how many videos I watch to try to understand the concept,
i just cannot fucking grasp the usage of pointers in golang.
i 100% understand what they are (memory addresses) and the benefits of using them (use address where data is instead of copying or passing around all the actual data). but none of that knowledge helps me develop a "muscle memory" for the ways * and & are used when reviewing pull requests or existing code.
I have no prior experience with pointers in any other language, so comparisons to C aren't helpful.
anyone else ever struggle really fucking hard with pointers in golang, no matter how much you "academically" understand what they are? any resources or exercises that might help it "click" for me?
https://dev.to/anvil/pointers-in-my-python-its-more-likely-than-you-think-2dfn - why does it sometimes copy by reference and sometimes by value? Because #pointers. Yes, even in #Python. Great series @eli.
Words fail me, and my worry for students grows.
Scientists May Have Solved The Mystery Of How The Andes Got So Big
--
https://www.sciencealert.com/scientists-may-have-solved-the-mystery-of-how-the-andes-got-so-big <-- shared article
--
https://doi.org/10.1016/j.epsl.2023.118009 <-- shared paper
--
[although my postgrad was in geology and I am licensed in the field, it has been a number of years since I worked directly in a geologic discipline; that said, I very much like to try and keep up with ‘things geology’…]
#GIS #spatial #mapping #geology #southamerica #data #modeling #model #mathematics #mathematicalmodeling #structuralgeology #andes #chile #peru #platetectonics #tectonics #tectonic #movement #mountain #mountainbuilding #remotesensing #geologists #orogeny #vulcanism #pointers #APM #RPM