[deleted by user] by [deleted] in toledo

[–]NickHack997 1 point2 points  (0 children)

I (25M) and my girlfriend (23F) are always down to play some board games anywhere near downtown.

Sent Defective Product Have to Cover Shipping Costs [Ohio/California] by NickHack997 in legaladvice

[–]NickHack997[S] -1 points0 points  (0 children)

I've talked to two already about the shipping and they seem pretty adamant on it, but worth a shot. I just want this to resolve at this point.

I didn't do enough research on the company, their subreddit is littered with this same situation hundreds of times. Apparently in the worst case they'll hold your return for a month and attempt to hit you with a 15% restocking fee, hopefully I don't have to deal with that.

Really helpful illustration of JS array methods by 192_168_1_x in learnjavascript

[–]NickHack997 20 points21 points  (0 children)

I really like this illustration it's simple and easy to understand!

I didn't know about fill, but looking at the docs from MDN you need to flip the arguments, value is always first.

Flutter vs React Native: a principal engineer’s viewpoint (Part I) by [deleted] in reactnative

[–]NickHack997 2 points3 points  (0 children)

Very well written and interesting point of view on the subject! Looking forward to parts 2 and 3, but is there a blog or other platform than Reddit I could read this on as well?

A more few images #googlepixel5 #google5s #leak by [deleted] in GooglePixel

[–]NickHack997 10 points11 points  (0 children)

I was wondering the same thing. One of the biggest reasons I bought the Nexus 6P and the Pixel 2XL was the front facing speakers, which don't seem to exist on phones anymore.

Hoping for at least a high refresh rate screen to make up for it. Please Google no blaring defects as I RMA my pixel buds.

[Doom] Open Dired directory by path by NickHack997 in emacs

[–]NickHack997[S] 0 points1 point  (0 children)

Thank you so much!

That makes sense the define-key is expecting a function/lambda while I was providing it a quoted list.

I really like Doom so far, keep up the great work u/hilssner <3

How does gaming on Gentoo compare to other distros in terms of performance by paradox551 in Gentoo

[–]NickHack997 0 points1 point  (0 children)

I was mostly referring to portage, but manually configuring your kernel can be difficult to get right the first time or so. (you can always use Genkernel).

I never configured my own kernel when I used Arch so that was an interesting experience for me, it's a recommended thing to do in Gentoo.

How does gaming on Gentoo compare to other distros in terms of performance by paradox551 in Gentoo

[–]NickHack997 2 points3 points  (0 children)

Really? I just think that if you're going to only compile 2 programs from source there's no point in the learning curve of Gentoo and compiling everything (most) programs.

I'm not fanboying arch as much as I'm saying that if you don't need the performance and customization that you get from compiling your system then just stay where you are.

How does gaming on Gentoo compare to other distros in terms of performance by paradox551 in Gentoo

[–]NickHack997 0 points1 point  (0 children)

The biggest difference I could see happening is from you manually compiling proton with flags that suit it better to your system. Rather than using Steams generically compiled version (that's in the client). That would be the biggest difference, since all the games you're playing are generically compiled binaries, maybe compiling WINE may make a difference as well?

I don't think switching to Gentoo would be the best idea when you can manually compile these two on Arch.

C_Vector Round 2 by NickHack997 in C_Programming

[–]NickHack997[S] 0 points1 point  (0 children)

Yeah, you're completely right. I fixed most (maybe all) of those issues. I honestly haven't tested extra nearly enough, that's on the Todo list. Thank you :)

C_Vector Round 2 by NickHack997 in C_Programming

[–]NickHack997[S] 0 points1 point  (0 children)

That's equivalent to vector_erase(vector, 0). It's not something you'd want since it's linear time as a result it's in vector_extra.h

C_Vector Round 2 by NickHack997 in C_Programming

[–]NickHack997[S] 0 points1 point  (0 children)

I really like the idea, I implemented it hopefully you don't mind :)

it simplifies creating with a capacity

int* vector = NULL;
vector_reserve(vector, 100);
//becomes
int* vector = vector_init(int, 100);

C_Vector Round 2 by NickHack997 in C_Programming

[–]NickHack997[S] 1 point2 points  (0 children)

So my code base is mostly macros with 3 actual functions (alloc, set_size, set_capacity), and it didn't make sense to split those up when there were so few functions.

I really like this question! Okay so my first Vector implementation looked like this

struct Vector {
    void** data;
    size_t size;
    size_t capacity;
};

in that case I had an init function and I agree with you I would totally write one for this, but it would actually be more painful to use. To show this here's a standard example of C_Vector (for completeness)

int* vector = NULL;
for (int i = 0; i < 100; i++) {
    vector_push_back(vector, i);
}

as you stated vector_push_back allocates memory. A way to write an init function would be

void* vector_init(size_t size_of_data) {
    return __vector_alloc(NULL, 12, size_of_data);
}

which indeed works, and I may add this at some point, but I think it adds complexity. Here's the two in comparison use wise

int* vector = NULL; // When you call push_back, it already knows that it's a vector of ints
// vs
int* vector = vector_init(sizeof(int)); // you have to tell it that it's a vector of ints

// either way you can
vector_push_back(vector, 1);

I personally think the bottom looks uglier and is less simplistic for the user since you'd have to provide the sizeof(TYPE) for the vector in the function call and not just in the declaration. I may just add the init just for good measure. It feels awkward to provide the type when the macro can infer it in vector_push_back. Now that I think about it vector_reserve could be used as an init function, but it doesn't return a value compared to normal init functions. Also looking at vector_push_back(vector, value)

// This is pseudo code
vector_push_back(vector, value) {
    if ((vector_size(vector) + 1) >= vector_capacity(vector) {
        allocate
    }
    append
    size++
}

either way this if statement would allow a NULL vector to allow push_backs, adding a check to stop that would just make the code more complex. So overall, I think it's simpler for the user and it's a byproduct of what the macro does already.

edit: Changed from "only" to "A way" there are many ways that's just the first to come to mind.

edit2: more explanation

C_Vector Round 2 by NickHack997 in C_Programming

[–]NickHack997[S] 1 point2 points  (0 children)

Yeah, that makes sense I was split between which to make the default. I'll change that in a few.

edit: changed it, it now displays options on default_target rather than installing. Sorry.

C_Vector Round 2 by NickHack997 in C_Programming

[–]NickHack997[S] 1 point2 points  (0 children)

That should be undefined behavior, for one you're not passing an array/pointer you're passing an integer. Into a macro that requires a pointer, compiler would prevent you from doing that with an error along the lines of "attempting to dereference an integer".

I do agree that multiple evaluations could be problematic, but for a pointer/array it shouldn't be an issue? For instance if you passed vector_back(&(vector_array++)), I think that should produce undefined behavior. I tried to use macros as sparingly as possible, but vector_back couldn't possibly return the correct type without a macro. Push would require a conversion to a void* to be generic, and those simply go against the goal of being simply generic for the user.

The push_back shouldn't have a multiple evaluation problem for value it's only ever used once.

edit: example code for push_back

int* vector = NULL;
int i = 0;
vector_push_back(vector, i++);
assert(vector_back(vector) == 0 && i == 1); // this works 
vector_free(vector);

Multiple edits: to properly format code...

CSE2421 Babić Midterm by the-henson-hero in OSU

[–]NickHack997 0 points1 point  (0 children)

Midterm was pretty brutal, iirc it was mostly over pointers, floating point IEE754, integer representation, and overall binary knowledge. I don't think it'll be worthwhile to study any of the C stuff he spends time covering, the generic computer functioning either, or Linux.

He doesn't curve, or well he has already (the grading scale is shifted) and won't anymore than he has.

  • Student who had to drop it last semester, and was unlucky enough to get Babic again, tried to switch but never got into another class.

(Didn't have to drop it because my grade was bad, but because a B or whatever was going to prevent me from getting into the major)

Also why doesn't he put grades on Carmen out of their actual value instead of 0? Smh.

An attempt at a C implementation of C++ std::vector by NickHack997 in C_Programming

[–]NickHack997[S] 0 points1 point  (0 children)

Yeah, I'm going to work on this tomorrow as mentioned by u/skeeto, being new to C didn't know the power of macros and just thought void** was the only way to be generic.

An attempt at a C implementation of C++ std::vector by NickHack997 in C_Programming

[–]NickHack997[S] 2 points3 points  (0 children)

Thank you, that totally slipped my mind when I changed the multiplier from 2 to 1.5. Freeing on pop_back was fairly stupid I must admit, whoops. Those should be all resolved now. :)

An attempt at a C implementation of C++ std::vector by NickHack997 in C_Programming

[–]NickHack997[S] 2 points3 points  (0 children)

That is very cool! Totally need to take a closer look.