mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.8K
active users

#pointers

0 posts0 participants0 posts today

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.

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... :neofox_floof_explode:
#til #clang #pointers #programming

I'm unraveling an Unreal Engine editor crash bug.

When the crash happened, the editor got confused internally between 2 characters. One has a set of pointers that the other does not.

When the game starts, and it's time to head to work, a vendor instead sprints to (0,0,0), and the log says one of those pointers is missing. It is not. It is missing in the other character because they are of 2 different base classes, and it doesn't have those pointers. That character with the "missing" pointer was once spawned in the game, but not as a vendor. What they have in common is the same skeletal meshes and animation blueprints.

Somewhere, somehow, it thinks both skeletal meshes use the vendor base class. Uh... no.

I saw the confusion when I was deleting the location markers. It showed both characters were using the location marker that it can't find when the game is running. Uh... no again.

About to delete the character it's confused about. Not the vendor. Yet. I may delete both of them and start over. If this breaks it all, well, thank goodness for backups.

#GameDev#UE5#RPG

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?

I'm still designing my language.

Why not just introduce RegExps into pointers?

int *a; /* nonnull pointer to single int */
int *?a; /* can-be-null pointer to single int */
int +a; /* nonnull pointer to array begining */
int +?a;

Isn't using the nonnull __attribute__ a bit long?

Now yes, I don't see the point of + and +?, but there is the 'array of unspecified length' syntax:
int *argv[];
so why not?

Vanessa Patrick's research highlights the difficulty people face when saying "no" and the lack of scientific research on the topic. To combat this, she has developed a module to teach people how to communicate "no" effectively while maintaining relationships. Patrick stresses the importance of personal policies in shaping one's life.

#Pointers #Dogs #Evolution

phys.org/news/2023-06-youre-go

Scientists May Have Solved The Mystery Of How The Andes Got So Big
--
sciencealert.com/scientists-ma <-- shared article
--
doi.org/10.1016/j.epsl.2023.11 <-- 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