« first day (2351 days earlier)      last day (2581 days later) » 

10:00 PM
I can try. But I'm a little rusty.
And someone "borrowed" my copy of the new testament and didn't give it back. Grrrr.
 
In my main I have a pointer to a struct that has elements h and w
 
deus vult @dmckee
 
There, I can access these elements like
int foo = IST_logo->h;
IST_logo is the struct
Now, I have a function that takes SDL_Surface **_logo
How do I reference the element inside the function?
 
i wanted to make a religious joke about that but figured i'd just not say it
 
Something like (*_logo)->h ought to do it, I think. Hard to be certain without looking at more of the code.
 
10:03 PM
Ha
It's the parenthesis that were missing
interesting
 
And I feel compelled to complain that you shouldn't be using _ prefixes. They are reserved.
 
I know, I will refactor the naming
I just need to bootstrap this
Thanks @dmckee!
 
bootstrap?
 
Lots of the precedence relationships for c's operators are weird enough that parentheses spring up in odd places.
@BalarkaSen In this instance "the new testament" is the 2nd edition of The C Programing Language by K&R.
 
@0celouvsky "Just make it work"
 
10:08 PM
Though someone needs to write an equivalently short and dense book for a newer version than c90. Alas Ritchie is gone.
 
Yeah, Ritchie is gone :(
I'm glad Knuth is still around
 
why?
 
He's a Computer Scientist's Computer Scientist
 
he's going to release another edition of his books
and they're gonna be more expensive than ever
@BernardoMeurer What does that even mean?
 
Yeah, he's nuts, he says he's going to volume 10
He's currently at 4
@0celouvsky Not sure, someone once said that about Grothendiek and I thought it sounded cool
 
10:12 PM
he was a nut
lots of these guys are bonkers
 
Perelman...
 
which guys
 
> Although in applications we deal with analytic manifolds as a rule
wat
I've never once seen an analytic manifold used unironically
Lie groups don't count
 
$\Bbb R^n$ is analytic
Hm
I think the guy who told me that maybe we could have contractible curves covered by simply connected charts if they were injective was wrong
Or... was he
I'm not sure
the example in mind is fairly convoluted
No I think he might be right
 
@Slereah there are plenty analytic manifolds
But one never uses them as analytic manifolds
 
10:29 PM
wait what
The new coordinates don't include the old coordinates
Oh, I think those are just arrival times
nvm
I'll have to work out the coordinates myself
 
@dmckee Still here?
 
11:10 PM
I like when a book talks about things I already know
I can nod violently while reading
 
Hm
 
@BernardoMeurer Well, I'm back.
 
If we have two spacetimes $g^1_{\mu\nu} = \eta_{\mu\nu} + k^1_{\mu\nu}$ and $g^2_{\mu\nu} = \eta_{\mu\nu} + k^2_{\mu\nu}$
Is $g_{\mu\nu} = \eta_{\mu\nu} + k^1_{\mu\nu}+ k^2_{\mu\nu}$ a spacetime, assuming that $k^1$ and $k^2$ have disjoint support
 
@dmckee How can I calloc a 2D array so that I can access it like foo[a][b]?
 
Pretty sure it's correct
 
11:16 PM
Uh...
 
Yeah :P
 
Try something like int *(foo[a]) = calloc(b,sizeof(int[a]));
Maybe.
Formally, of course it is a pointer, but you can still access it with array semantics.
 
@dmckee If I try that everything is red, lol
 
But I have to warn you, that code using this kind of trickery is a pain to work with unless you can isolate all the clever bits.
 
"Compound array initializer is expected"
 
11:20 PM
@BernardoMeurer I take that is you IDE tell you it is systactically incorrect?
 
Yes
/home/meurer/src/prog/project01/main.c:75:5: error: variable-sized object may not be initialized
     int *(board[game_sz]) = calloc(game_sz, sizeof(int[game_sz]));
     ^~~
GCC doesn't like it either
 
Then I'm stumped without getting a book and really poring over it.
I miss my K&R.
 
Hmmm
Let me try some pointer magic
 
Y U abuse compiler?
 
^^ words that almost always presage disaster.
2
 
11:24 PM
int **board = (int **)(calloc((size_t)(game_sz), sizeof(int *)));
for(int i = 0; i<game_sz; ++i) board[i] = (int *)calloc((size_t)(game_sz), sizeof(int));
board[0][0] = 1;
Works
@DanielSank Abuse? How?
 
3 mins ago, by Bernardo Meurer
Let me try some pointer magic
 
@DanielSank Oh, I didn't go for the magic :P
 
@BernardoMeurer makes sense, because to do multilevel indexing in C you need to have an array of pointers
 
I went for the verbose way
@DavidZ Yep :)
 
When I've had to do this I made a macro INDEX_2D(n, i, j) = j * n + i or something like that, then I could just do board[INDEX_2D(n, 0, 0)] = 1 and the like
I didn't want to bother with the complexity of arrays of pointers
 
11:27 PM
@DavidZ Yeah I'm trying to steer away from macros
I think this pointer to pointer approach is nice enough
 
Sure, whatever works for you
I suppose you can get away with malloc-ing the first array because you're initializing all the elements right afterward anyway
 
This is already me refactoring my refactor to make it less refartorant so that the prof accepts my code
@DavidZ calloc is faster than malloc on linux :P
 
really? weird
 
@BernardoMeurer why?
 
Yep, for really interesting reasons, I have an article, one second
@DanielSank Because the kernel cheats
 
11:29 PM
@BernardoMeurer Did you see what I was saying "why" to?
 
186
Q: Why malloc+memset is slower than calloc?

kingkaiIt's known that calloc is different than malloc in that it initializes the memory allocated. With calloc, the memory is set to zero. With malloc, the memory is not cleared. So in everyday work, I regard calloc as malloc+memset. Incidentally, for fun, I wrote the following code for a benchmark. ...

@DanielSank Nope :P
Because I dislike macros
 
@BernardoMeurer o_O
 
I think they look ugly and are generally not needed
 
@BernardoMeurer Ho boy. Ok, try to write a nice RPC system.
 
I will using solely GOTO
and booleans
 
11:32 PM
You'll get rekt.
@0celouvsky change your username to ILoveMeasureTheory.
 
@BernardoMeurer oh, that's different. malloc + memset will of course be slower than calloc. But you're not using memset or any equivalent, so that's not relevant for your code snippet.
 
@DavidZ My bad, I need everything to be 0-initialized
I also generally dislike malloc
I think it makes it easy to screw up and access unitialized memory
 
I'm just saying you don't need board to be zeroed in this case, not unless you're doing some multithreading nonsense or the like. Not that it really makes a huge difference.
 
Stop generally disliking stuff. Different stuffs are good for different things, and stuff.
 
@DavidZ Hm? I'm telling you I NEED it zeroed for my use case :P
@DanielSank I dislike GOTO
 
11:42 PM
@BernardoMeurer Ever used one?
 
@G.Bergeron Every week
 
@BernardoMeurer why?
 
@G.Bergeron Coding in assembly for my MIPS CPU, Writing C code but the implementation of libc is incomplete (I'm writing my own kernel).
 
@BernardoMeurer In what physics coursework were you asked to do that o_0 ?
 
@G.Bergeron None.
 
11:46 PM
None
 
Computer engineering courses.
@BernardoMeurer I beat you.
 
MIPS part for Computer Architecture
kernel part is to satisfy my masochistic tendencies
 
dafuq is MIPS?
Million Instructions Per Second?
 
An ISA
 
It's too low-level for me... I like reading about it, understanding it and using what others did!
 
11:47 PM
Not very good one, but easy to make
 
Something about no interlocked pipeline
in the cpu
 
I'm the kind of Computer Limbo
 
@BernardoMeurer what do you mean?
 
I always go to the lowest level :P
 
@BernardoMeurer Me too! ... in theory.
@BernardoMeurer So when do you plan on refining silicon and doing lithography? :p
 
11:52 PM
@G.Bergeron In a couple years :P
 
@BernardoMeurer False. I'm working with capacitors and circuit traces, boi.
rekt
 
I'm starting to work on rebuilding SH in a Spartan 6 right now
@DanielSank Yes, you also cannot compute anything that requires more than 15 bits
 
shaddap!
 
(I have never been rekt harder than that. Ever)
 
11:53 PM
<3
That was meant as an incentive
Now you work not just for money and recognition, but for your honor to unrek yourself
 
@BernardoMeurer Hmm... that depends on how you count!
In a a way, you are on the digital level of abstraction and he is on the analog level (possibly). Hence, there are so much more degrees of freedom interacting with an analog computing power blasting away anything you're doing :p
 
@G.Bergeron I'll accept that when his computer runs Doom
Cause even my calculator does
 
@BernardoMeurer Bwah, your rigging the test in your favour
 
Am not! Running doom is a test standardized by the ISO
and recognized internationally
 

« first day (2351 days earlier)      last day (2581 days later) »