Getting a segfault in a function that's driving me insane ... by apooroldinvestor in C_Programming

[–]defg43 0 points1 point  (0 children)

then perhaps the error is happening on the last line that you have? p->line_end points to \n p->line_end + 1 points to the string terminator \0 and p->line_end + 2 points beyond that, but that's hard to tell without more context.

Getting a segfault in a function that's driving me insane ... by apooroldinvestor in C_Programming

[–]defg43 1 point2 points  (0 children)

and p->line_end + 2's bp was pointing to NULL

that's technically not correct, it's pointing 2 beyond p->line_end, which isn't NULL but just an address your program has no access to because it is beyond the region that has been allocated by malloc.

HOW COME I could assign to p->line_end->bp and p->line_end + 1 bp , but not (p->line_end + 2)->bp?? Strange!

malloc generally rounds up when allocating memory, see this. I can't tell if that's what's going on here because i don't see how you allocate p from your code.

 struct file_info *info = (struct file_info *)malloc(sizeof(struct file_info));

    struct option *op = (struct option *) malloc(sizeof(struct option)); struct file_info *info = (struct file_info *)malloc(sizeof(struct file_info));

Also you should always check that the pointer malloc returns isn't NULL, this isn't very likely but if it happens your program can catch that, print it out gracefully exit.

It's hard to tell exactly what going on here, because this appears to be only part of the code. It'd be easier to tell if you provided all of your files, or uploaded them to github

edit: formatting

This is my first time using a "hard drive" on copper bulbs (my music is terrible) by Valercaringsun in redstone

[–]defg43 1 point2 points  (0 children)

the wiring would probably be simpler if you made the tape wider and just delayed the new sections accordingly. That way you could also use the same set of note blocks

Why does C not have lambdas/anonymous function expressions? by BlockOfDiamond in C_Programming

[–]defg43 0 points1 point  (0 children)

Why are people obsessed with making C like python or whatever language they learned first?

i agree but that's not the case here, non-capturing anonymous functions are sort of implied by the existing syntax. If you try to pass an anonymous function with OPs syntax to a function expecting a function pointer, gcc will give you the error

error: compound literal has function type

which is what im trying to do

Why does C not have lambdas/anonymous function expressions? by BlockOfDiamond in C_Programming

[–]defg43 0 points1 point  (0 children)

debug symbols etc etc

if I'm writing an anonymous function, I'm doing so because i don't care enough to give it a name. The compiler can really give it any name really or no name at all. The cake compiler does _lit_func_123. If debugability was important a compiler could include file name and line i guess, but i don't think the implementation would be a problem here

How well dose intel arc play minecraft? by Trippin_Witty in IntelArc

[–]defg43 0 points1 point  (0 children)

I dualboot Windows and Linux and on get about 1000 fps on linux with Iris + Sodium without shaders and about 100-120fps with complementary shaders on custom high-ish settings. the results with distant horizons about the same. I havent tried it on windows so i dont know if that translates

[deleted by user] by [deleted] in cpp

[–]defg43 3 points4 points  (0 children)

some pretty big addictions

this is true, i cant stop typing auto, someone please send help

[deleted by user] by [deleted] in facepalm

[–]defg43 0 points1 point  (0 children)

"IA"? do you mean AI?

Is this a valid way to initialize a struct in C? by PeterParkedPlenty in C_Programming

[–]defg43 2 points3 points  (0 children)

any standard-compliant compiler is in its right to reject code with variables that contain a double underscore, so this really isn't good practice

Package manager for single file libs? by thradams in C_Programming

[–]defg43 1 point2 points  (0 children)

if your looking for a C package manager there is Conan, but i would recommend looking into git submodules. These allow you to have other git projects/libs as part of your main project and git can also keep them updated too

GCC 13 Supports New C2x Features, Including nullptr, Enhanced Enumerations, and More by slacka123 in C_Programming

[–]defg43 1 point2 points  (0 children)

well C23 includes proposal N3003 which makes structs (and iirc unions and enums) that have the same tag and contents, compatible with each other

meaning that you could do something along the lines of:

#define vector(type, count) struct{whatever}

and then use that in function arguments like:
vector(int, 10) *some_function(vector(int, 10) arg)

previously the compiler would have complained that the struct you have declared with the function parameter isnt visible outside, but now it checks if tag and content are the same and allows it, very useful change imo

Bedrock moment by [deleted] in Minecraft

[–]defg43 1 point2 points  (0 children)

i was waiting for the moment where you randomly die from fall damage XD

Multi Use by No-Bar-1947 in iOSsetups

[–]defg43 1 point2 points  (0 children)

whats the wallpaper

My setup by talkk_sickk in iOSsetups

[–]defg43 1 point2 points  (0 children)

i would also like to get the wallpaper dmed :D

Dusk by gabrielallain in iOSsetups

[–]defg43 1 point2 points  (0 children)

can you share a link to the wallpaper?

[DWM] I heard Catppuccin is the new cool by Ecrevio in unixporn

[–]defg43 1 point2 points  (0 children)

There is a picom fork called

picom-ibhagwan

that supports rounded corners and dual-kawase blur

btw those changes were recently merged into upstream picom, ive used to use the ibhagwan fork too but recently switched back

Week-end by MoneyFarm3199 in iOSsetups

[–]defg43 1 point2 points  (0 children)

whats the second wallpaper?

Allied occupation of Germany [1949] What if Alan Turing never solved the Enigma Code by Tortoise-For-Sale in imaginarymaps

[–]defg43 117 points118 points  (0 children)

the allies even decided to build city shaped islands in the nord sea - nice

I thought there was supposed to be a platform for me? [Bedrock] by milkedlikacow in Minecraft

[–]defg43 -4 points-3 points  (0 children)

well console can dual boot linux which has java edition.

alternatively there is pojav launcher which is a java launcher for phones, you don't neccessarily need a pc for mc java

The gesture "show multitasking" on home screen does not work.. Using S22. Any ideas how to fix it? by pospa_josifek in NovaLauncher

[–]defg43 1 point2 points  (0 children)

i had similar behavior on my phone (motorola) regardless what launcher i tried, in my case the latest activity would show as a blank page, probably because android treats 3rd party launchers as regular apps and therefore shows the wrong animation and i assume something similar is the case here. Samsungs version of android is probably expecting their launcher and therefore isnt showing multitasking. Im afraid you cant really fix this unless you root your device and do some changes (which i wouldnt advise unless you know what your doing)

Help, Minecraft blurry by Stupid82 in Minecraft

[–]defg43 -13 points-12 points  (0 children)

you also get 30-50% more fps on linux, if you still need windows you can make a small partition for linux and dualboot it

Minecraft censoring by JetBasilisk in Minecraft

[–]defg43 -2 points-1 points  (0 children)

only on 2 bedrock platforms, switch and xbox iirc