« first day (112 days earlier)      last day (3527 days later) » 
00:00 - 12:0012:00 - 22:00

12:20 AM
@PeterVaro: Thank you.
 
 
6 hours later…
6:48 AM
say um, would anyone entertain what might be an absurdly silly question before I post it?
 
7:16 AM
@Praxeolitic what kind of question? :)
 
hi there!
well I was looking at the Python source code, and I saw something funny, I don't know if it's just a quirk or if it is the distillation of profound knowledge
what struck me as odd is: #define MAGIC (62161 | ((long)'\r'<<16) | ((long)'\n'<<24))
oh wait, nm, this makes sense now, omg, haha jk
I was confused and thought shifting by 16 implied a char size that might be greater than 1 byte
 
return;
helloc @Praxeolitic && @darknight;
first time here?
 
hi, yes! :-D
 
and you are reading the source code of python, aren't you? very well done!
are you going to build something through the C API
or you are just curious what a well maintained, large C source look like?
 
well both, I want to eventually understand how Python dynamically loads C code
but I can think of plenty of things that would be great to script up in Python but have a core element that is performance critical
I know of dlopen but I'm curious about the infrastructure python builds around it
 
7:32 AM
that's also a super choice => write the performance critical parts in C, but glue them together and control them through Python
 
exactly, I work on a project that is mostly coded in C++ but only a very very small portion is performance critical and that part is mostly stationary
the need to understand and write C++ really just excludes potential developers and wastes time
 
you are good ;) I mean, I'm doing the same thing for the same reason myself
my C part is the OpenGL drawing, but the control is coming through Python
I'm creating a very thin and very abstract layer on the Python level
so that the speed of it almost doesn't even matter, and the C part can act separately as fast as it could be
 
neat, I have only the faintest familiarity with OpenGL, but how's this going for you?
 
the reasons are similar to yours: python makes it easier to "hop-in" to the project, to test ideas, to hack a few things together, etc. (with a very expressive but also very simplistic way)
@Praxeolitic well, currently I'm working on the C level (look at here and scroll down to see it actually can do)
but we'll see.. I really tried all the GUI drawers, and I couldn't find the one I was looking for (both speed and flexibility and lightness) so that's why I started to work on my own
 
oh wow, "Put all faith in StackExchange" indeed! lol
 
7:42 AM
:D
 
it's surprising that even after putting up the website the Code Review attention is rather modest
 
well, tbh modern OpenGL is still not that popular among SE devs
and actually on the web as well
most of the tuts and infos out there are mostly about the old fixed pipeline way
-- well these are my thoughts.. I have no proof this is true or not;)
helloc @darknight; // wb
 
@PeterVaro Hi, yeah me too first time
 
<thumbs up/>
I'm glad you are here -- any exciting C projects lately?
 
Not yet,, Working on a PPT to be presented on monday!
 
7:53 AM
what is it about?
 
Threads..,
 
umm... lovely topic! in general? or specifically in C?
 
General.., Had some trouble understanding about Kernel threads and User threads.. Took some time and mastered it!!
Exploring the chat room,,,, Wonderful!!!
 
room topic changed to C: C stands for Control. [ About the room: goo.gl/9J8g3S | Collected questions: c-faq.com | Explain C in english: cdecl.org | Everything about pointers: boredzo.org/pointers | Full C refernce: en.cppreference.com/w/c/header | C11 standard: open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf | How to ask: sscce.org ] [c] [c11] [c89] [c99]
@darknight well I think chat is a very nice place on SO;)
@Praxeolitic Are you completely lost in my blog? (just kiddin' it is not that entertaining ;))
room topic changed to C: C stands for Control. [ About the room: goo.gl/9J8g3S | Collected questions: c-faq.com | Explain C in english: cdecl.org | Everything about pointers: boredzo.org/pointers | Full C reference: en.cppreference.com/w/c/header | C11 standard: open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf | How to ask: sscce.org ] [c] [c11] [c89] [c99]
// damn.. I missed an "e" in "reference" :P
 
8:39 AM
helloc all
room topic changed to C: C stands for Control. [ About the room: goo.gl/9J8g3S | Collected questions: c-faq.com | Explain C in english: cdecl.org | Everything about pointers: boredzo.org/pointers | Full C reference: en.cppreference.com/w/c/header | C11 standard: open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf | How to ask: sscce.org ] [c] [c11] [c89] [c99]
dayum a newline does not work
 
@Apoorv I have to ask again: don't you think I tried that before? ;)
helloc @Apoorv;
 
@PeterVaro i keep forgetting :)
 
9:01 AM
still pure gold ^
helloc @BartekBanachewicz;
 
@PeterVaro lol, just noticed. another interesting bug appeared: on every 10-15-20th (basically at absolutely random) running the program produces this, and then crashes:
@PeterVaro hi
 
@BartekBanachewicz those are all fixed for a while now
 
> 50,000 vertices / 47 FPS
 
I just didn't have the time to post updates onthe latest improvements
 
that looks absurdly low
@PeterVaro oh I see
 
9:03 AM
@BartekBanachewicz right now it is 300k/180FPS
 
you can't run at 180 fps
 
you know how silly FPS as a measurement is
 
btw: you can remove the buffer swapping limitation
 
oh your code is using GetShaderInfoLog; have you changed to debug output?
 
9:04 AM
and even if your monitor can't draw faster than 60FPS
 
uh oh and a lot of unnecessary type erasure
maybe I should do that code review :P
 
if you want please, but that was an oversimplified dummy code
which is not in work anymore
 
@PeterVaro oh well
 
the new approach I'm doing is completely different
 
void
draw(void *resources)
{
    Resources *rsc = (Resources *)resources;
why would you ever do anything like that, though?
Why not void draw(Resources* resources) ?
I don't see why type-erasing is necessary here if you cast anyway.
 
9:07 AM
@BartekBanachewicz because in that test case I did not want to include the header where Resources is
into the public header which contains draw()
but as I said, that was in a test environment, and not in the production code
 
@PeterVaro wait what
why didn't you forward-declare then?
 
^ that's what I avoided there
 
you compromised type safety because you didn't want to include something o.O
yeah well I'm not at all surprised this code was buggy :P
 
oh you have absolutely no idea where the bug was ;)
because it wasn't close to any type safety issues
 
and what do you think would be a type safety issue :P
 
9:10 AM
the one you just mentioned above
 
I don't understand the problem?
 
If void *resources is allocated, and is being treated only as (Resources *), what could go wrong?
 
@DrorK. nothing ofc and under the hood the whole pointer casting to pointer doesn't do much
but @BartekBanachewicz thinks that's the problem -- which is ofc not
 
@DrorK. it's not typesafe.
 
9:13 AM
helloc @TheJoker;
 
the compiler doesn't verify it.
 
@BartekBanachewicz that's why you cast it, to help the compiler ;P
 
I linked the Abject Failure of Weak Typing yesterday
 
I know what you mean: I can pass anything to draw()
 
@PeterVaro Why? The compiler showed any warning without the cast?
 
9:14 AM
yes exactly.
 
but in a max 1k LoC test environment
that's not going to happen
 
@DrorK. the function can only operate on Resources, so why pass it anything else?
 
@BartekBanachewicz Well maybe it's uncommon, but as far as generic functions with allocated objects goes, that's valid
 
@DrorK. there's nothing generic about this function
 
@DrorK. no, actually @BartekBanachewicz is right, since inside draw()
afaik I accessed Resource members
but, he is wrong about the problem
 
9:17 AM
it will crash on anything other than a Resources object.
 
because that wasn't the problem at all.
 
@PeterVaro this kind of mistake leads to problems though
this and not wrapping OpenGL properly.
 
but it did't since, it was in a well monitored tiny environment
 
you managed to take a tiny environment and introduce 3 bugs in it
now how's that for "didn't" ?
that's the point with not creating abstractions properly
 
and which of them was related to Resources?
 
9:19 AM
I would love to see the code you guys are talking about
 
anything beyond trivial becomes absurdly and unnecessarily hard
 
@BartekBanachewicz you have absolutely no idea what you are talking about, haven't you?
:D
1 message moved to Trash can
when you are posting a dummy environment
you try to remove everything, and makes it as small as possible
and since we are talking about OpenGL itself
 
@PeterVaro right, I have never coded anything using OpenGL, I forgot.
 
you don't want to encapsulate it with any abstraction layer
in my actual code
it is encapsulated -- and has tons of abstractions on it
 
so your idea of a simple example is removing all of the abstractions the code is based on?
what the hell.
Next time I post a Python question I'll be sure to post the pypy generated assembly
 
9:22 AM
yepp -- if the question is related to the stuffs under the abstraction
@BartekBanachewicz if the problem is related to the assembly it was generated, then you should
 
I tried to to copy paste, from my nearly at least 5k LoC code to make it under 200 to be sscce.org
 
why don't you just use OpenGL from python directly?
 
sure, there are mistakes and so beautiful solutions
@BartekBanachewicz read the older blog posts
btw: @BartekBanachewicz if you can solve (which I already did) the problem about OpenGL (not the C code) of the problem I posted there -- be my guest
I'm glad to talk about that -- otherwise, I don't care about your opinion on a non production code
 
@PeterVaro I must say, the code snippet you posted were enough for people to give meaningful feedback?
 
9:25 AM
which problem now
 
snippets*
 
@DrorK. yepp
 
@PeterVaro I'm clueless. :)
 
@BartekBanachewicz the one posted on CodeReview
 
oh look what I found
Don't pass around void* unless you have to (e.g. because it can be any kind of pointer). In your case you know what it is so you can use the proper type. — ThiefMaster May 24 at 21:05
 
9:27 AM
@BartekBanachewicz have you read the next few comments also?
 
Even if we'll agree that it's uncommon, and bad practice
It is still valid and conforming
 
> since the caller does not know what pointer that is.
 
it is, and it will always work in that special scenario I created there
 
So obviously if it generated an issue, the problem is with the implementation, not with the code
Usually people twist the words of the standard, to make it more relaxed and less strict
We came to the day were we're trying to be more strict than it's already is? :)
where*
 
A.h -- [internal] typedef Resources
B.h -- [internal] draw()
C.h -- [public] incomplete Resources and draw()
--
A.c
B.c -- include A.h
C.c -- include A.h and B.h
^ This was the case (IIRC)
 
9:31 AM
yeah we all know that lack of module system is an embarrasing thing
 
in this scenario, it was a perfectly valid move, to make it void* instead of Resources
 
it wasn't.
 
it was.
 
lmao okay.
do as you want.
 
I will.
 
9:32 AM
why do I even bother
 
I have no idea.
 
I clearly have no idea about using OpenGL
or programming
 
You clearly haven't.
 
:D
I'll just mute you for a few days and see if this behavior continues.
 
3 mins ago, by Bartek Banachewicz
do as you want.
 
9:35 AM
@PeterVaro The issue could be caused due to biased distribution of random input?
 
@DrorK. nope the issue was related to Nvidia drivers and Macs and OpenGL
had nothing to do with the code I posted
I had to use another type of GL function call and packing to make it work
anyway, I gtg now, bbl
goto away;
 
 
2 hours later…
11:16 AM
return;
 
@DrorK. anyway, BartekBanachewicz is right about using specific types whenever you can, which will makes your code more-compiler friendly therefore less error prone, however, I still can't stand, when someone thinks, without knowing (or even bother asking) the exact reasons behind a design decisions, that one can know what is the right choice (and for that reason needs) to complain and criticise
 
What the above code will print?
 
this behaviour is arrogant, aggressive and stupid, even if the answer is correct
 
@PeterVaro Are you talking to me?
 
11:21 AM
helloc @afzalex;
absolutely not ;)
one sec I will read your code, gimme a mo'
 
user1804599
@PeterVaro I know Bartek. He's a troll when it comes to anything that isn't Haskell.
 
@rightfold I know right?
helloc @rightfold;
 
Thank you @PeterVaro
 
user1804599
@PeterVaro I didn't know you know. How could I tell?
 
I keep saying he is a troll since he first showed up in June
@rightfold I could tell because the exact same reason as you stated: everything is shite if it is not his favourite language of choice (haskell)
@afzalex okay, so what is the question?
is this a quiz question or a homework?
or are you simply testing us? ;)
 
11:27 AM
I was giving a test on internet
 
I see, umm.. have you tried to actually run that snippet?
 
What you think the answer to this code should be?
 
without running what do you think what will that snippet do?
 
No. the answer I given was wrong. and Now I know the answer but don't understand why the answer is that.
I thought answer should be 1,1
but it was not that.
Should I tell you the answer before letting you think what the answer should be?
 
if this was the case:
    int i = -1,
        j = -1;

    i=0;
    j=0;

    i++;
    ++j;
it would be 1, 1 as you stated
 
11:31 AM
I though it should be, but the answer is 1, -1
 
so -- clearly, to find the answer to "why" is 1, -1
you should
take a look at the logical AND statements
 
I though the value of i and j is changed to 0, isn't it?
 
(one sec)
 
(two sec)
(three sec)
(four sec)
sorry, couldn't resist xD
 
hmm.. @afzalex that is a tough one..
 
11:38 AM
is it
 
I think it has something to do with the assignment as an expression
 
I thought if I will post it in stackoverflow I will get downvotes
 
combined with the logical AND operator..
@Kamiccolo any thought on this?
oh I think I got it @afzalex ;)
 
hmmm
 
what is the main property of the AND logical operator?
what does it do?
 
11:41 AM
I am a java programmer
so
 
(especially what will it do with evaluation of expressions?)
@afzalex it is the same in java and in python as well
 
and will return true if all conditions are true
 
^ is that the whole truth?
(btw: the phrase is not 'return' but 'evaluates to', as it is not a function but an expression)
 
okay
but I don't understand
 
should I say the solution
or will you think a bit more about it?
 
11:44 AM
wait
 
@PeterVaro just wondering... why putting into brackets forces i++ to execute first. But it doesn't work that way with if/while.
 
even if you have the answer @Kamiccolo wait until @afzalex says we can tell him
 
I got this
I think
 
tell me
 
i value is changed to 1 from 0
 
11:48 AM
@PeterVaro not sure yet :}
 
(i=0)&&(j=0) set i = 0 and j = 0 but after it they are changed to 1
 
Only have this check:
        int i = 0;

        if ((i++) == 1)
        {
                printf("%s \n", "Test passed!.");
        }

which doesn't fire :}
 
&& operator let the expression to evaluate
Is I am right?
 
okay here we go:
So the AND will evaluates to `true` only, if both sides (as it is a binary
operator, it has two "arguments") will evaluates to `true`. But this also means,
if even one of the sides is `false` it doesn't have to evaluate further, because
the expression has to be `false` as a whole => it won't evaluate the second
"argument" as it will be redundant
and since i=0 is false
j = 0 won't be evaluated
and when we say i++ that means it is 0 at the time when the value of it is used
 
Ooops
 
11:50 AM
and it will be increased by one later
so that means 0++ is also false
 
I think the answer to this question is interesting.
 
therefore ++j won't evaluate
 
I don't even thought it would be working this way.
 
oh, damned, I was trying to prove the wrong answer xD
 
:)
@afzalex in C/C++ the logical AND and OR operators according to the standard will only evaluate the other side if necessary
it is called IIRC "lazy evaluation"
 
11:52 AM
:18863735 yup, but though j had another value xD
 
Thank you guys
for helping me
 
no, thank you @afzalex, it was an interesting problem ;)
I'm glad we figured it out :D
 
:)
 
00:00 - 12:0012:00 - 22:00

« first day (112 days earlier)      last day (3527 days later) »