« first day (1132 days earlier)      last day (2513 days later) » 

5:12 AM
@supercat Thanks, but any function pointer is technically a "pointer to any function type", except that it doesn't have implicit conversions... that's what the code sample intended to illustrate
Using 'void *' with a context is the common convention and has many uses- but that's not the purpose of the code sample, it's specifically for illustrating how pointers to functions should be handled generically
 
 
5 hours later…
9:56 AM
@DrorK. I'm here, yeah
 
@PeterVaro Morning :)
 
10:12 AM
hi
 
10:54 AM
@DrorK. so you wanted to have an IRC conversation with me -- I'm here if it is urgent, if not, we can do it from this saturday to next sunday, as I will be on a holiday during that time :)
helloc @Owatch;
 
@PeterVaro Oh, nevermind about that, have a nice holiday!
 
hehe, I will be mostly at home and I will focus on finishing some of my pet projects (mostly in C :))
so I will be available :D
 
Even Sherlock Holmes doesn't solve puzzles without any clues. You didn't give us anything. — DeiDei 8 mins ago
 
LOL :)
 
11:16 AM
Absence of clue is not clue of absence
@PeterVaro Are you a fan of Unit testing?
 
Dror is like "do you want enter in my sect ?"
 
@DrorK. a massive one (unit + integration + functional)
and also a massive fan of TDD
 
@PeterVaro I knew it!
 
how did you?
;)
 
I knew that after questioning 3 dozen of people, I would probably find one :)
 
11:19 AM
hehehehe :)
 
what did the others say about why they don't like it?
do you?
 
@PeterVaro You have your own framework? Is it C based? How do you mock without adding lots and lots of passing of function pointers and excessive indirections?
@PeterVaro I don't bother asking "why not", I only care for "yes", and "how"
 
I am working on a concurrent unit-test-running framework in C atm, as a matter of fact, that was the pet project I was referring earlier
:)
so mocks and stubs.. yeah, that is a tough one in C
what I usually do, is I create conditionally-compiled versions of my code -- and mock the things where they are -- it is not that nice, and definitely not as good as running the exact same code in testing as I would do in production
but it is still a thing, that is working
heck, I can even get access to translation unit internals (eg. statics)
I don't think there is any more elegant way of doing it, but, if you came up with one, then share it with me, I'm all ears
where I can, I create test specific mocks in the tests, casting them to what I wanted them to be, and analysing those
but sometimes I have to do the conditional compilation, which I mentioned above
 
So far I simply suffer the cost of extra indirections and passing around pointers to functions
I don't like paying the toll, but I guess I dislike my alternatives more
 
11:27 AM
well, tbh if you would give me a specific case, I would start thinking about it -- I'm not saying I can come up with anything groundbreaking, but at least I can try, can't I? :)
 
I guess at the end of the day we might as well write it off as being a premature optimization
 
I believe in premature optimisations!
:)
and I also belive that phrase is pretty much misunderstood
 
Do share!
 
> The irony about Knuth’s quote is that the people who most often quote it would be horrified by its original context. Knuth made this statement in an article in which he argued in favor of the careful use of go-to statements for micro-optimization in performance-intensive loops. He would probably flunk a modern code review. -- Stop Misquoting Donald Knuth!
 
@DrorK. two, at least >_<
 
11:30 AM
@Kamiccolo I didn't want to ruin the statistics :)
@Kamiccolo Never let the facts get in the way of a good story!
 
0 is nice. 1 also. 2 as well. 4 is not that much worse... 8... :D
 
> Considering performance in the small is not “premature optimization”, it is simply good engineering, and good craftsmanship. As software engineers, we have largely forgotten about our obligation to create quality programs where efficiency is concerned. Stop Misquoting Donald Knuth!
so yeah, these are pretty much the same thoughts as I have on this subject
these are not talking about optimisations, that the compiler can do -- worrying about those is stupid, and premature
and we are not talking about micro-optimisations here either
one should compile and test and measure the code and act according to the results, but before that, one should start think and work like an engineer
 
goto is the only way in C to stop a nested loop
 
goto is a superb thing, and one should use it quite often in readable and maintainable C code
the quote on goto is evil is also a misquote
 
@PeterVaro I think that I understand what he's trying to say, and I think he's pretty much wrong
 
11:36 AM
who?
 
haha, rust have a great feature, you can label your loop so you can choice which one you want to break
 
I don't think it's ever a good idea to first consider efficiencies
 
@PeterVaro ant pretty much veneric one
 
@Stargateur that is just one specific case of using goto
 
yeah but it's safe in rust
 
11:37 AM
Even if your goal is efficiency-critical program/algo, I still would consider it wrong to consider efficiencies "first"
If you know before hand exactly how it should do something, and what critical to its performance, then by all means, go ahead, and take it under consideration
So now the question is: Is this realistic? ... when was the last time you've stumbled somebody who knew the considerations precisely, and he made decent decisions at the beginning of the road taken?
I keep hearing of people wasting their time, or having misconceptions about what they try to do, and why it backfires on them. I don't recall hearing about any other cases
 
@Stargateur in C gotos are safe, they are limited to the function scope! I don't think you can go any further than that. If you are talking about life-cycle-management, then it is a different issue
 
indeed, I talking about that.
 
Can't seem to read from directory file.
Always getting a -1 code.
 
@Stargateur then your observation is irrelevant regarding to goto, since your comparison is C vs Rust there in general
 
but I love use goto in C, just because people hate that, for example I prefer infinite loop by writing a goto ^^
 
11:43 AM
@Stargateur Most probably that the people who hate goto in C, belong to the same group of people-who-hate-C
 
@DrorK. I don't think the article is talking about that! I think it is more about the craftsmanship and experience -- you just know how to solve small portions of you code efficiently, maybe even mid-scale ones
 
@PeterVaro No this is linked, rust lifetime management permit to do safe goto. In C you need to be carafull of the state of your variable.
 
and if you do know, then you should do it
 
@PeterVaro That's only true if it's true
 
@Stargateur in C you have to be careful with everything. In general. Period :)
that's not news :)
@DrorK. okay, I have to get back to work, but we can continue discussing this one later on, I'm interested in your opinion on the subject!
free all; // bbl
 
11:46 AM
Have fun, I'll keep experimenting with frameworks of unit testing
Not bad: "Code that provides the wrong answer, no matter how quickly it does so, is infinitely slow."
 
transmute to SO: "answer that provides the wrong answer, no matter how quickly user does so, is infinitely useless."
 
Well, wrong answers- more often than not, are being engaged by knowledgeable people, who correct the poster and add explanations with context. And since somebody bothered to post it as an answer, it only increases the chances of it being a common misconception that maybe other share
It's the same even in ##c ... when a beginner asks a question, most probably that the more knowledgeable people wouldn't find it 'crucial' to answer it
But once somebody provides a wrong answer, it's impossible for them not to engage
 
12:01 PM
@PeterVaro except cases like... Apple.
. . .
hashOut.data = hashes + SSL_MD5_DIGEST_LEN;
hashOut.length = SSL_SHA1_DIGEST_LEN;
if ((err = SSLFreeBuffer(&hashCtx)) != 0)
    goto fail;
if ((err = ReadyHash(&SSLHashSHA1, &hashCtx)) != 0)
    goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0)
    goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
    goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
    goto fail;
    goto fail;  /* MISTAKE! THIS LINE SHOULD NOT BE HERE */
 
@Kamiccolo Obviously the problem is with the programmer, not the code
 
always add bracket to if, this is not an issue about goto :p
 
I don't add redundant brackets to if statements, and I still find it to be a problem with the programmer
 
@DrorK. yup, for sure :} Isn't it... always? Or most of the cases, at least?
 
why add brackets is redundant ???!!!
 
12:03 PM
I don't believe in the concept of.... a dog has bitten a child... the dog should be put to sleep
 
You can always blame solar radiation, butterflies, whatever... Every single time it boils down to humans writing the code...
 
The owner of the dog has created the circumstance for his attack dog to bite children, and therefore killing the dog for the actions of his owner, is silly at best
 
I guess the bigger problem was the owner being stupid enough and not training his damned dog properly.
 
@Stargateur If the brackets are not needed, they are technically redundant. If you like them, use them- but there's nothing stopping you from making mistakes
 
Well... there is a way to stop making mistakes. It is... doing absolutely nothing.
 
12:06 PM
I don't agree, this is not redundant.
 
@Stargateur Are you trying to say that the brackets are required?
 
this is redundant:

if (blabla) {
  {
     blabla;
  }
}
 
Actually that's a bad example :)
 
no bracket here are redundant
 
{ blabla; } ... introduces an inner block scope
 
12:07 PM
that my point
 
if () {} ... doesn't introduce a new inner block scope
Which means that the { blabla; } <-- isn't redundant by definition
if (blabla) { { blabla; } } ... and: if (blabla) { blabla; } .... are two different things
 
optional bracket when your if have only one statement don't mean that put brackets is redundant, this is just optional.
 
if (blabla) { blabla; } ... and: if (blabla) blabla; .... mean exactly the same thing
 
but I let you discuss about this with rust dev who choice to not allow missing brackets...
 
We're having a disagreement over the definition of the word redundant? :)
 
12:09 PM
yes
 
@Stargateur By your definition, redundancy when it comes to replication, doesn't exist
Or even, redundancy when it comes to storage backups
 
no, my point is that missing bracket are error prone and there is no reason to not always add them
and I am right just look the code... of apple
 
There's nothing wrong with that code
 
just because "i'm lazyyyyy"
 
I don't blame criminals for being criminals, just as much as I don't blame bugs for being bugs
It makes no sense :)
 
12:14 PM
I blame dev who don't have good practice
 
So now we're 1 step towards 50% of the solution
We recognized our problem --> the person who has created the problem, is the problem
Whether what you consider to be good practice would've helped this person, maybe
 
this bug could be avoid with good practice.
 
But I don't think that self-preferences are indicators for good or bad practices
 
This was an error to authorize missing brackets
int main() return 0; // why not ?
 
Maybe under your preferences it should be considered as an error, under other people's preferences it's obviously not
 
12:20 PM
this is not a matter of style, and I have clues how many bug do we need before peoples realize this is a bad idea !
 
When I think of it, if a programmer can't take care of simple diagnostics to avoid such basic things, then maybe it's no longer the programmer's fault... so now I'm leaning towards their employer :)
 
oh you never do a mistake because you don't have put brackets ?
you are perfect ?
 
I don't think that I'm perfect, but I've written a diagnostic tool for this a couple of years back
And back then when I actually written things, I never actually triggered it.
So yes, I was under the false misconception that it is a big issue, I come to find out I was wrong and I never actually needed to waste my time writing this diagnostic
 
this is not a clue...
it's your personnel experience
 
I never claimed that my conceptions belong to anybody else ^
BTW, here's another example of redundancy, when I test pointers I do it like so: void *p = NULL; if (p == NULL)
The explicit/verbose form of "== NULL" is redundant
 
12:35 PM
this is a question of style
 
Everything is a question of style, but the fact that this is redundant and verbose in-comparison to the alternative, is a fact
 
not really
the alternative is if (!p)
I will agree with if (p != NULL)
but this is not prone to bug
so no this is not the same thing that missing bracket
no, not everything is a question of style
 
I think you're missing the point of my example with the pointer ^
Being redundant is not the same as being "bad"
 
I think that you say that because you are more a theoretic than practice.
 
I give up, I can't figure out how to read directories. Just getting -1 whatever I do. None of the structures are the same as those described in the book, and the source files had redefinition upon redefinition.
 
12:46 PM
@Owatch You never give your code or something to help you. Like always...
 
That's a matter of style!
 
do you add perror() to know the error ?
 
I just want to complain.
 
haha
 
Don't we all
 
12:47 PM
People say that 50% of the solution is recognizing the problem, then I guess 50% of debugging is ranting.
 
I'll source the code in a bit I guess, but I don't know how you can help unless you're running macOS since it seems to be system dependent.
 
@Owatch There's no point for you to bother with code samples, every day you repeat this ritual of: "I have a problem it will never work!" ... 5 minutes later: "Oh it was silly, fixed it."
 
No, this time its for real.
 
Okay, so take 10 minutes :p
 
just look error with perror...
-1 is good... like down vote... but not very usefull
system() is not a system-callFelix Palmen 1 min ago
 
12:52 PM
system() is called "command execution".
Just on a side note, why do the authors of this book on C seemingly insist on putting main first, and then having to forward declare literally every function (even for other functions) below?
I always put main at the bottom. It's just habit I guess for me. Also means I don't need to forward declare much.
 
style question... :p
 
@Owatch have you used readdir() or scandir()?
 
@IljaEverilä No, since the purpose of this exercise is to basically "implement' that.
 
Right-o
 
?!?!?§?!,!,!,!,!?!?§?§?§??
 
12:57 PM
Stargateur is having a stroke.
 
Who do you call...?
 
I endow my personal belongings (except debt) to Owatch [ ]
 
ghostburs...
 
Please sign there Stargateur, quickly!
 
If you want inherit of my debt
but now I'm curious, you try to read a dir with... read() ?
 
1:00 PM
Yes.
 
I don't think that his creditors are going to give a second thought to the "(except debt)" thingie
 
I guess having to decipher directory structures manually makes for a lesson
At least you learn to appreciate portability :D
 
Heh
 
I don't think you can use read or fread to read an directory
Asking for the behavior of undefined behavior is mostly futile. — πάντα ῥεῖ 5 mins ago
 
1:27 PM
@Stargateur I WIN!
There's a draft of my defect report!
HAHA!
 
It has only taken a 2 weeks campaign to achieve that
 
this is not a lot with C committee.
 
Well, there's still a long way to go, but it's one step forward
 
2:15 PM
@JonathanLeffler Hello again, I'm considering marking my own answer as the accepted answer, since it seems that my DR will be submitted soon. If you expect to post your answer anytime soon, I can wait. Otherwise I think it would make more sense not to keep the question open, and wait for the official decision of the committee as to my suggested TC.
 
@DrorK.: Do as you wish; I'm not hunting the bounty. I
I've also been 'busy' and didn't do much towards my write-up y'day. Maybe today...but don't hold your breath.
 
Well, you've participated in my question even before I offered the bounty, so I'm fairly sure that's not a consideration for you :)
I just don't think there's much point for the question to be 'promoted' since it seems that I've already achieved my goal. But I guess waiting a day or so wouldn't make much of a difference.
 
@Stargateur Just for you my lovely: pastebin.com/035pUCdX
I'm actively trying to figure out why it tells me that a directory isn't a directory right now, but maybe you can find it faster if you can compile i.t
I put all the stuff you might need to tweak in macros so it would be easier (extraction of names and such from system types)
Hold on a second, I need to add in a missing function call!
Alright, here's the fixed version: pastebin.com/EZfi4RZT
 
@DrorK. you have to tell us more about how and when they accepted what we've been fighting for :)
 
2:33 PM
When running the program I provided, does anyone else find that it can't read any files within a directory? It just prints the directory file size, and that's it.
Okay, made some small format changes to it. Last time I paste don't worry. Just clean up output and fix some string copy.
 
where did you have the error when you read() ?
On linux read don't work with dir
 
Well, I get the error when reading dir. It is caught in readEntry on line 135 by the if guard.
readEntry: Couldn't read at least one entry.
In this conditional:
if (code == -1) {
    fprintf(stderr, "readEntry: Couldn't read at least one entry.\n");
}
 
use perror here
or just printf errno
what is the error ?
 
I don't know what the error is. -1 is the only output for read if something goes wrong.
It can likely happen for a couple of reasons.
 
USE PERROR MOTHER ******
 
2:48 PM
Oh, I'll try to put it in now.
Maybe I'm using perror wrong, but nothing else but the same line is printed.
I guess there is nothing set in errno.
 
???
use it before printf
 
if (code == -1) {
    perror("readEntry: Couldn't read at least one entry.\n");
}
This is how I have changed it.
 
and the output is ?
 
Exactly as I stated before. Just the normal statement.
That was the change I made before you asked I use it before printf.
Ah no wait there is this: : Is a directory
Full:
RN-145-97-178-173:Desktop Owatch$ ./fsize
readEntry: Couldn't read at least one entry.
: Is a directory
.	      510 bytes
 
well, same that linux
you can't read a directory
 
2:58 PM
hallo
 
But when I call stat on it, it says I have read/write/ access?
drwxr-xr-x
Hello Kevin.
What OS are you running?
 
emacs
 
Is there anyway to bypass read not working with dir?
 
3:02 PM
I have no idea, I don't think
 
Well that sucks, I was looking forward to using this sample program. :|
Was kind of cool.
I love using all these different types of desktops on Xubuntu.
They are all so ridiculous
 
user6448973
hi
 
welcome and helloc @MohitVerma :}
 
user6448973
:)
 
3:56 PM
1
Q: C++ strict aliasing: Isn't this MSFT example UB?

ThomasMcLeodOn this page regarding a certain Winsock struct, the example appears to be taking the address of a struct and casting the resulting pointer to a pointer to a completely different struct. SOCKET ListenSocket; struct sockaddr_in saServer; // Bind the listening socket using the information in the ...

 
To All: I'm considering marking my own answer as the accepted answer, since it seems that my defect report will be submitted soon. If you expect to post your answer anytime soon, I can wait. Otherwise I think it would make more sense not to keep the question open, and wait for the official decision of the committee as to my suggested TC. Thanks a lot for your help and feedback, very much appreciated! — Dror K. 17 secs ago
 
well, you can :p but I don't think that your bounty will be for you :p
 
I know
But there's no point to keep the question 'open' for new blood or existing blood
 
4:23 PM
Egh... I'm struggling with development environment for Windows o_0 why the hell it has to be soooo overcomplicated....
 
@Kamiccolo Bigger is better! Go Big or Go Home!
 
4:54 PM
@DrorK. it does not... fit
 
More complications, bigger complications, OVERcomplicated, don't settle for less :)
 
damnit. Spent ~5 hours installing visual studio 2008, and it appears that it's the wrong one... plenty of extensions needed aren't supported anymore. And to uninstall it... I had to run like... 10 uninstallers :D
By the way, today it was the rainiest days during last... ~60 years o_0
 
So when are you making the full transition to using Windows everywhere?
 
@Owatch NOOOOOOOOO, god, please, no
just a tiny library port...
 
So is Vilnius now Venice?
 
5:00 PM
@Owatch it was. And it might become one tonight again.
I have forgotten how fucked up the Windows world is....
 
Windows 10?
That flooding is quite bad.
I think vehicle manufacturers should look to water proofing their cars in the future, since they're going to need it.
 
@Owatch not to mention like... couple of inches of water INSIDE buses and trolleybuses....
7.
Screw the 10. 8 as well.
 
10 is supposed to fix 8 by emulating 7.
 
5:38 PM
windows is great
whatchu need
 
@Kevin great for what? I need proper C support and to make libusb work.
 
isn't the windows binary good enough? :D
likely libusb sucks if anything. lol. should be able to clone and use the .sln to open a project that builds with ease
 
6:07 PM
624
A: Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' after installing Visual Studio 2012 Release Preview

ShortThis MSDN thread explains how to fix it. To summarize: Either disable incremental linking, by going to Project Properties -> Configuration Properties -> Linker (General) -> Enable Incremental Linking -> "No (/INCREMENTAL:NO)" or install VS2010 SP1. Edits (@CraigRin...

o_0
 
7:04 PM
Well I got the file size program working.
But unfortunately most of the code I had put in is redundant.
For one, I had to use readdir to get anything useful from the DIR object.
And then I figured out I also had to create the DIR object with opendir.
Feel like its just a cheap solution in the end but I couldn't figure how to bypass these errors otherwise. :(
By the way, have any of you ever tried using clients like MUTT for mail?
 
@Owatch yeah
 
7:51 PM
@Kamiccolo Is it worth using over a GUI based email client?
Or just using the web version?
 
@Owatch it depends
 
For attachments, images, and so forth. I am considering trying to install MUTT, but it must be able to provide the same facilities.
 
8:06 PM
@Kamiccolo Is it fine for downloading attachments? Or viewing images?
Some crappy emails embed contents in stuff like that, or have all sorts of formatting. How does that work out?
 
8:44 PM
@Kamiccolo haha, "I have forgotten how fucked up the Windows world is....", everytime
@Kamiccolo I can just advise you to install the last MSVS, it fix a lot of thing
 
 
1 hour later…
10:06 PM
helloc();
 
10:35 PM
helloc @Idle001; :}
 
@DrorK. answering then accepting own answers, slick and ego, so people i know this is beyondthe verge of C scope to C++ , just solliciting your inspecting view on this 1- it does throw an exception due to seg-fault why ? 2- why the op is comparing addresses ? 3- what is the point of his sarcastic comment ?
hey @kami
ok we can knock away the last note
 
10:53 PM
33
Q: printf and long double

gameboyI am using the latest gcc with Netbeans on Windows. Why doesn't long double work? Is the printf specifier %lf wrong? Code: #include <stdio.h> int main(void) { float aboat = 32000.0; double abet = 5.32e-5; long double dip = 5.32e-5; printf("%f can be written %e\n", aboat, aboat...

 
11:10 PM
@Idle001 si? :}
 
why people bounty answered question
 

« first day (1132 days earlier)      last day (2513 days later) »