« first day (496 days earlier)      last day (4466 days later) » 

6:00 AM
Not sure if you can tell, but the CURL is detected, but 'curl_easy_init' is not there for some reason...
So the header file must be getting read correct?
 
@hetelek you have to link to the curl library
Look up the instructions for your IDE and it will tell you how to add library names to the list of libraries that you want to link
also, do you want to redistribute the curl DLL with your program (dynamic linking) or do you want to include the functions of curl in your own program (static linking)?
 
static linking
 
Then you have to do a bunch of other stuff too
one second
 
Man I'm dumb... I got it to run.
I added 'LIBS += C:\libcurl\7.24.0\lib\libcurldll.a' to my pro file.
 
Ok, and also you should add CURL_STATICLIB to the list of preprocessor definitions if you want to statically link it
 
6:05 AM
Alright, thanks.
I'm so dumb...
haha
 
It's not just you :)
 
:) That's good.
 
posted on February 24, 2012 by Scott Meyers

In 2002—ten years ago!—I gave my first-ever presentation on the effective use of C++ in embedded systems. That presentation was sponsored by Programming Research, a firm that develops static analysis tools for C and C++. Such tools were near and dear to my heart then, and they're no less so now, so I was pleased when Programming Research asked me to collaborate with them again. The result is tw

 
damn my internet connection. for some reason it's become slower than a dial-up today.
and randomly disconnects
 
@IntermediateHacker well, same here. but this connection i'm on is via the old NMT 450 cellphone network, which after it was discontinued as cell phone network was reused as a kind of outback's internet. the connection quality depends on the weather, but on the bright side, can be used throughout Scandinavia
I'm too lazy. I'm contemplating walking to the kitchen and make some coffee. But it seems like a lot of work.
 
6:24 AM
I'm supposed to be fixing my rendering system, but that's a lot of effort too :P
ah, right
for some reason, the Direct3D headers aren't working
ok
why on earth am I pulling in the property sheet interface?
christ, Windows headers, you suck
 
@DeadMG Windows headers are all or nothing :)
 
yeah
 
horrible design
 
they have these handy-dandy defines, which are supposedly for limiting what you need
but given the size of the header, in reality, you'd need like, 10000 of them
 
lol
@DeadMG does Windows have a #define for a strlen function that works when UNICODE is and is not defined
 
6:37 AM
_tsclen, I believe
but only MSDN would know
 
@SethCarnegie yes, but don't use it
 
@CheersandhthAlf why
@DeadMG yes that's the one, thanks
 
well, frankly, there's no reason to use char* anymore
the only reason the whole UNICODE and TEXT thing existed was for portability between Windows 98 and Windows NT
 
I thought it was for multibyte/single byte charsets
 
@SethCarnegie because it's a hell of a lot work to really support ANSI, including that I don't believe programs built with recent Visual C++ will run on Windows 9x (which is the target platform for ANSI version of program)
 
6:39 AM
@SethCarnegie Nope.
Unicode does everything ANSI does, but better
 
In short, it's just stupid to do ANSI char for a Windows app
 
@CheersandhthAlf what if it's not meant to be a specifically-windows app
 
Unix uses UTF-8, I believe, which would be char*
 
I'm using char* because it's more general than using string or something
 
but you're going to have to re-write everything that depends on the Windows API and those TEXT macros and defines anyway
 
6:40 AM
@SethCarnegie Then the Windows automagic is worthless
 
@SethCarnegie Wait, you're using char* in general?
what the hell are you smoking?
 
@DeadMG for a library
 
std::string > char*, in every circumstance, in every place, always
 
I don't need its capabilities sometimes
If I return a string, it's std::string, if I take a string that I don't modify or do anything like that with, it's const char*
 
deterministic exception-safe destruction is always a necessity
 
6:41 AM
@DeadMG let the caller worry about the management of their strings
 
const char* is not the same as char*.
 
right
which is std::string
 
@SethCarnegie Is there a way to add all those clang options to default? So I don't have to copy/paste that long mess every time I compile something?
 
if you wanted to enable the use of super-optimized custom string representations, you'd need to take a templated range of iterators
 
@Mysticial no idea :)
 
6:42 AM
I think it's quite simple to do cross-platform Unicode. I use UTF-8 encoded std::string everywhere and do a just-in-time conversion to UTF16 when interfacing with WinAPI.
 
so that I can also use std::deque<char> or char* begin, *end or anything like that
 
@Mysticial you might be able to find the place in the source that lists the default libs or something but I haven't tried
 
but taking char* or const char* instead of std::string or const std::string& is just plain silly
 
I'm a silly person I guess
 
well, I hope that you enjoy the absolutely nobody who would use such a library
 
6:44 AM
lol
I don't see how making people pass std::string would help them use my library
 
simple
because everybody uses std::string
 
in the cases I use const char*, using std::string would just add overhead
@DeadMG then they can do str.data()
 
right
because making everybody perform the conversion all the time is the genius move
 
i only use char* when i have to, usually to talk to some c code, and even then i use str.c_str()
 
@SethCarnegie Overhead like O(n) length instead of O(1)?
Overhead like no SSO?
that kind of overhead?
 
6:46 AM
cause i simply don't feel like farting around with pointers when in most cases it's not necessary
 
overhead of no nice inlining STL algorithms?
 
@DeadMG making a copy of the data just to get the length is O(n) anyway
@DeadMG not using stl algorithms where I take const char*
 
@SethCarnegie Who said anything about copying? Between move semantics and RVO/NRVO, it's no big deal at all.
 
@DeadMG to construct the string from a literal I mean
 
What are your performance requirements when it comes to string handling anyway?
 
6:48 AM
right
firstly, premature optimization, probably, by a mile
 
don't care
 
and secondly, do what LLVM did and just make a class that can handle both cases
 
oh shit... <windows.h> compiles on clang... wtf?!?
 
@Mysticial yessa
:)
 
you construct the string from a literal once, anyway, if you're worried about performance
 
6:48 AM
@Mysticial The question is: does it link?
 
@StackedCrooked I'll find in a sec...
 
and pass the string around instead of a pointer
 
@cHao why not just never construct a string when I don't need the length or any of the features string provides?
 
GCC won't link, that's why MinGW project was started.
 
@SethCarnegie Because in a month's time, you will need it.
 
6:49 AM
@StackedCrooked wow really?
@DeadMG don't do stuff for the future, that's premature optimisation
in another form
 
no
 
If I need that then I'll add an overload for string
 
"Minimalist GNU for Windows" sounds really roundabout for "We need GCC to link".
 
std::string is easier to deal with than const char*
 
because it's there, and occasionally, you do need that stuff, and because strings require less mental gymnastics than pointers do
 
6:50 AM
you're paying the time cost for using const char*
besides, it's a billion times more likely that you will need to find the length of a string or something like that than you will desperately need high performance
 
@DeadMG nope
@cHao I'm not doing any gymnastics
 
@SethCarnegie Well, for a start, you can never trust const char* because the user might have freed it in the meantime
 
@DeadMG I'm not storing them
 
so you could never, ever, safely store a const char* beyond a single function call
 
I know my situation and you guys don't and I can see that const char* is fine
@DeadMG yep, and a single function call with each pointer is exactly all that I'm doing
 
6:52 AM
he he
 
right
but there's absolutely no value in const char* over std::string whatsoever
 
@DeadMG and in my case there is no value of std::string over const char* whatsoever
 
avoid dynamic allocation for arguments?
 
except that std::string is more flexible than const char*
so you gain flexibility for nothing
 
@DeadMG not when you're not doing anything that needs it to be flexible
 
6:53 AM
 
@Mysticial Awesome!
 
and how about just not pissing off your users making them endlessly convert for no good reason?
 
@Mysticial so I can assume that my instructions worked?
@DeadMG they can just do auto cstr = str.c_str() once and pass cstr all they want
it's not a big deal lol
 
for every time they call the function?
 
@SethCarnegie Yep... Time for something a little bigger...
 
6:54 AM
@Mysticial ouch! the colors! i'm glad i don't use clang
 
@SethCarnegie yeah, it is. that cstr is only valid til you do something to change that string
 
@Mysticial To be sure you should also see if you can use the common controls library.
 
@cHao yeah I know
 
@CheersandhthAlf They're Windows settings, not anything to do with clang
 
@CheersandhthAlf Yeah, Clang has the worst colors.
 
6:55 AM
and even if you have to do it every time, it doesn't matter, it's still a few extra chars
 
@DeadMG you're just trying to trick me. listen to crooked stack. clang has worst colors!
 
for every single time I have to call whatever function you're trying to provide?
 
@CheersandhthAlf Look at the VS Window. It's obviously been customized that way
@SethCarnegie What a waste
 
don't care, and neither does anyone else
 
6:56 AM
right
 
Pink seems like a tiring background color for development.
 
gotta love the ignore function
 
the only reason i'd bother with c_str is if i'm talking to c. outside of that, it has no value for me
 
posted on February 24, 2012

I think it's time to warn about integer arithmetic — specifically about the int type.

 
Yay, another something that is now evil :D
 
6:59 AM
I just one of my 1500 line mini-projects:
BBP.cpp:69:10: fatal error: 'intrin.h' file not found
#include <intrin.h>
         ^
1 error generated.
 
@Mysticial what is intrin
 
That's clearly a MSVC header...
 
@Mysticial also I might not have gotten all the necessary paths listed
 
it's full of MSVC intrinsics
 
@Mysticial Another case against int?
 
7:01 AM
@DrDobbs if you're still messing around with a 16 bit OS or processor, i don't care whether my code works on your machine or not.
3
 
That said, I never tested this file on Linux. It's mostly SSE4.1 intrinsics. I'm not sure exactly which MSVC intrinsic I'm using. It's been almost 2 years since I've touched this file.
BBP.cpp:71:10: fatal error: 'omp.h' file not found
#include <omp.h>
         ^
1 error generated.
 
@cHao Well the 16-bit story serves more as an historical backdrop than as an argument :)
 
So much for that... MinGW or Clang doesn't support OpenMP?
I can't find <omp.h> in the include paths either.
 
@cHao I think the bottom line is to not make assumptions on the size of int.
 
I'm still annoyed whenever I have to explicitly specify std::ptrdiff_t and then check that I don't get unwanted conversions. I'd rather use a range-for than deal with that.
 
7:06 AM
@StackedCrooked that i can semi agree with. but then, i forget whether there are any types you can make assumptions about, other than stuff like int32_t
 
I found the OpenMP <omp.h> header. But how it's barfing on all the SSE intrinsics...
 
@cHao I think you can assume that sizeof(char) == 1.
 
@cHao void* can hold a value for any type of pointer but I'm not sure if from that we can conclude that sizeof(void*) >= sizeof(T*).
 
The MinGW headers for SSE aren't compatible with Clang... so much for that... :(
 
@StackedCrooked but you can't even guarantee the size of a byte.
 
7:09 AM
I know.
 
@Mysticial also clang doesn't support exceptions on windows because of some problem (rubenvb said)
 
I noticed yesterday that boost::is_pod doesn't work on Clang (on Linux). It always evaluates to false.
 
Maybe I need to try using Clang's version of the SSE includes...
clang doesn't support OpenMP?!?!?!
 
Is it possible to open a URL in a webpage cross-platform?
webbroswer*
 
cross platform? i kinda doubt it
 
7:16 AM
Just click on the link?
 
huh?
 
@StackedCrooked some platforms don't have mice mouse devices
 
@SethCarnegie Ah, I see the problem now.
 
Hahaha
That doesn't count :)
 
i guess maybe you could hook into firefox and tell it to open a page...but then you make the assumption that the machine has FF installed
 
7:18 AM
I feel like that's a bad approach
 
ditto for any other browser
 
Awesome, it compiles, but it won't assemble!
C:/Users/Hina/AppData/Local/Temp/BBP-735608.s: Assembler messages:
C:/Users/Hina/AppData/Local/Temp/BBP-735608.s:8: Error: bad register name `%rbp'
C:/Users/Hina/AppData/Local/Temp/BBP-735608.s:9: Error: bad register name `%rsp'
C:/Users/Hina/AppData/Local/Temp/BBP-735608.s:10: Error: bad register name `%rsp'
C:/Users/Hina/AppData/Local/Temp/BBP-735608.s:12: Error: invalid instruction suffix for `call'
C:/Users/Hina/AppData/Local/Temp/BBP-735608.s:13: Error: bad register name `%rsp'
wait... I think I need to invoke the 64-bit assembler...
I think it's using the 32-bit assembler...
 
@Mysticial SSE?
 
@SethCarnegie After I added -m64, it started barfing on %rbp. That's a normal register.
 
@Mysticial maybe you should setup compiler to compile 32-bit code instead
 
7:26 AM
@Abyx This mini-project example I have requires 64-bit compilation since it uses several 64-bit only SSE4.1 instructions. I probably shouldn't be trying to compile something this complicated right off the bat...
Problem is that I don't have any self-contained projects that are smaller than 1,500 lines.
The only other self-contained (and 32-bit compatible) project I have is a whopping 170,000 lines long...
 
@Mysticial I had that problem too which is why I couldn't do a very good test
 
C:\Users\Hina\Desktop>as BBP.s --64
Assembler messages:
Fatal error: no compiled in support for x86_64

C:\Users\Hina\Desktop>
Bullshit...
I swear I installed 64-bit MinGW...
The assembly file itself looks fine. I just don't know how to invoke the MSVC assembler to test it...
 
@Mysticial you can't, it's AT&T syntax
 
@Abyx Oh shit... you're right...
 
only *nix assemblers understand this unreadable crap
you can try compile it with something like yasm
 
7:36 AM
Could offsetof be implemented without relying on undefined behaviour by using std::declval?
 
I think that's enough for tonight. @SethCarnegie You might want to add some of this to the guide.

1. Windows headers seem to work.
2. Currently only works for 32-bit.
3. 64-bit compiles fine, but won't assemble.
4. SSE probably is fine. (I haven't tested a working SSE on 32-bit though.)
 
@Mysticial why do you still think I should post the guide when rubenvb has prebuilt versions
@Mysticial and thanks for testing btw
 
Unless you have a specific idea.
 
Ah speak of the devil @rubenvb
 
@SethCarnegie present. What's up?
 
7:39 AM
@rubenvb we were just talking about you :)
 
@SethCarnegie I'd say make the guide anyway. I'm sure once the word gets out, (I have an idea on how to do that.) much more capable people will come and patch it up.
 
64-bit won't assemble? I guess Clang?
 
@Mysticial do you still think the SO Q/A format is fine
 
Is this SVN trunk or one of my builds?
 
@rubenvb 3.0 src
 
7:41 AM
@SethCarnegie please don't use fixed releases. They're old, and svn trunk is stable as hell
 
@Mysticial much more capable -> many more capable ;)
 
at least for windows
 
@rubenvb well we can't figure out how to compile the SVN trunk on windows
 
I think the assembler problem was fixed just after release
 
@SethCarnegie It should be fine. "How to compile Clang on Windows" Add a brief description of what/why you're trying do. Cite the GoingNative presentation about Clang not having any Windows support yet.
 
7:42 AM
@SethCarnegie I believe trunk didn't work :)
 
@SethCarnegie cmake-gui ../../Source/LLVM
 
Then post these step-by-step instructions (which are very clear btw).
 
then you select MinGW Makefiles as generator
Set Release as CMAKE_BUILD_TYPE
And then uncheck ENABLE_ASSERTIONS for speed
 
it's really easy to compile Clang with VC++, just generate .sln and press F7
 
Then you copy everything in the build's bin directory to my MinGW-w64's bin directory
if you need the headers and libs, copy those over too
I don't see the problem
 
7:43 AM
@rubenvb sorry, I mispoke: clang svn trunk compiles perfectly on Windows, however the MinGW headers don't work
@rubenvb clang complains about things not being in the std namespace when it encounters some using std::x statements, and a lot of other things
 
@SethCarnegie ok, I'll check that out (probably this weekend or so)
 
@SethCarnegie The MinGW headers for SSE definitely don't work. So set the path to the Clang ones instead.
 
@Mysticial no, I just tried to #include <iostream> and it threw up
 
@Mysticial Clang should find its headers first (without tricks)
@SethCarnegie which GCC version?
 
@rubenvb 4.6.1
 
7:45 AM
@SethCarnegie what was the error?
 
x is not a member of the std namespace
 
@SethCarnegie x being stuff like cout?
 
@rubenvb also if I don't set the include path manually to mingw headers, then I get no such file as iostream or whatever that error is when it can't find a header
@rubenvb no, other stuff, can't remember exactly
@rubenvb I can try to repro if you want
@rubenvb actually it's up in the chat log some where
 
@rubenvb Oh, you're right, I had to change the include directories because clang didn't have <omp.h>. Apparently clang doesn't support OpenMP.
 
@SethCarnegie did you copy the binaries to the proper MinGW-w64 directory? My headre search paths fix only works for sysrooted toolchainss (everything together in one folder like mingw64
@Mysticial indeed, there are loose plans to do so, but LLVM proper needs support first
 
7:48 AM
@rubenvb which binaries? And I'm using 32 bit mingw
 
@SethCarnegie From MinGW-w64 or MinGW.org?
 
I'll attempt a hail-mary to try and compile y-cruncher v0.5.5 for x86 SSE... Gonna be interesting...
 
@rubenvb can't remember
 
@SethCarnegie important, MinGW.org doesn't have the right paths, use my MinGW-w64 builds, they ought to work
 
@rubenvb what do you mean the right paths? I did all the correct paths manually
with -I
 
7:51 AM
@SethCarnegie manual intervention shouldn't be necessary (if clang.exe is alongside gcc.exe in a MinGW-w64 toolchain directory). I fixed Clang for that.
 
@rubenvb the clang I had a problem with was the SVN version, and also it doesn't matter if the include paths shouldn't be necessary, because even when I fixed them up manually, they errored
@Mysticial I guess I'll go ahead and write the Q now?
 
@SethCarnegie OK. I'll build a fresh Clang and try it out
 
@SethCarnegie Sure.
 
Interesting... it doesn't have some of POSIX libraries.
The Windows version of y-cruncher isn't compiling because of <intrin.h> and a ton of other MSVC-specific dependencies.
The Linux version isn't compiling because not all the POSIX features are there...
 
8:00 AM
@Mysticial:
I have been trying to find a way to get Clang working with Windows but am having trouble. I get Clang to compile successfully, but when I try to compile a program I have a bunch of errors in the standard headers.

I am aware of [rubenvb's prebuilt versions of clang](http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/), but I want to compile it for myself. I also was listening to the GoingNative talks about clang which said that it didn't have very good Windows support yet. How can I get clang working on Windows?
Is that fine?
 
Looks good. (aside from markdown fail)
 
yeah lol
 
Do we have enough people here to give it enough early upvotes to put it in the hot-list?
 
If you have a link...
 
I don't wanna rely completely on linking it. But that's what I'm going to do regardless.
 
8:06 AM
0
Q: How to compile Clang on Windows

Seth CarnegieI have been trying to find a way to get Clang working on Windows but am having trouble. I get Clang to compile successfully, but when I try to compile a program I have a bunch of errors in the standard headers. I am aware of rubenvb's prebuilt versions of clang, but I want to compile it for myse...

I love it how you cannot post a block of code after a list without having some text outside the list
So annoying
 
Add the C and C++ tags
 
@Mysticial lol, that would help
@Mysticial hmm they're not showing up
I added them
 
now they are :)
 
Oh I thought you said you added them lol
 
the lambda crash has been fixed, they're supported now
 
8:09 AM
@rubenvb not in 3.0 :)
which is the only version that accepts the headers we have
 
@SethCarnegie who on earth uses a Clang release?
:p
 
@SethCarnegie why the masochism?
 
argh, Direct3D, you irritate me
 
@rubenvb refer to my other 50 comments saying that it's the only version that will work with the mingw headers
lol
 
8:10 AM
@SethCarnegie that's doubtful, all my builds use 3.1pre
you're probably pushing the mingw.ORG headers to their limits
use MinGW-w64
seriously
 
@rubenvb that's what we've been talking about this whole time
 
I won't help you get mingw.ORG working
 
I would like to design and build a secure media player for linux in cpp,
does you have any tips/exist modules i can use or be
familiar with their API ?
 
@rubenvb I don't think that's where I got them from
 
8:11 AM
@SethCarnegie well, TDM GCC 32-bit is also MinGW.org
there's also a lot of Russians and Dutch people compiling MinGW.org for x264 compilation
but I gotta go now
cya in about an hour
 
Same, see everyone later
@Mysticial thanks again
 
cya
 
8:46 AM
@ZoZo123 a secure media player?
 
9:24 AM
such a thing exists?
 
9:34 AM
Secure media player? Like one that doesn't play executable binaries? :D
 
What's cpp?
The C preprocessor?
 
You guys can be harsh sometimes
 
I shudder at code consisting of only macros. :-P
 
I made C++ into BASIC once using macros for 9 year olds to move robots like those turtle/beetle things used to
 
Why didn't you just teach them C++?
 
9:40 AM
I imagine awoodland isn't as passionate as you when it comes to torturing 9 year olds.
 
Or you could use C++ to make a proper BASIC interpreter
 
And vice versa?
 
At least it'll give way better error messages than said macro-based BASIC language
 
@daknøk I only had 2 hours and I wanted them to make Braitenberg vehicles with both software and hardware
 
Ah I see :P
 
9:42 AM
Should've made them program in straight assembly. :-P
 
Machine code. Happy debugging!
 
That's how I first learned microcontrollers
Then again I'm a bit of a masochist.
 
Xeo
@SethCarnegie, you here?
 
Now if you learnt them C++ they would be scared to death. They'd never want to program again, and I'd have more chance to get a job. :P
 
they had 12 year olds writing C++ last week though with a full weeks workshop
 
9:45 AM
Sounds fun.
 
Hopefully it's proper C++ and not "C with classes" BS
 
I learnt that "C with classes" bullshildt back in the days when I was 12, using cplusplus.com.
 
it was using player/stage I think
the guy who designed the workshop is anti-"C with classes"
but the point was the robots not the language
 
Robots are lots of fun! I made a robot that physically solved a Tower of Hanoi problem for a school science fair
 
that's quite cool
 
9:49 AM
The thing was of course attached to an actual PC so that people can see what it's "thinking"
 
we use them lots for "getting kids enthusiastic about CS" type things
 
The thing was made of a frankenstein-like setup of K'NEX pieces and breadboards and wires and stuff. :-)
 
K'NEX was awesome
 
Yeah my university holds a lot of events like that for middle school and high school kids
They're lots of fun for the kids and the people who build the exhibits. :-)
 
the one I'm doing this year is on web security though
which does mean I deliberately wrote the most vulnerable web application possible
 
9:54 AM
Why didn't you use something made by Sony? :-P
 
Let me guess.
SQL in the query string?
 
check
 
I mean they pretty much did your job for you
Did you use a "Bobby Tables" query?
 
@Insilico that may be true, but there's an ethics form :)
 
Xeo
Damn, I hate that. :s When I see somebody being on SO 4min ago, and that's exactly the moment they go afk, meh.
 
9:55 AM
@Insilico not quite - there's a way to get it to dump the passwords though (in plain text of course)
 
sbi
@cHao That's bad thinking. 15 years ago, I also thought that, if my code would just compile with the popular Windows compilers at the time (BCB, VC), I'd be fine. Then I got a job where everything had to compile and run on Windows and Mac. And then came Linux. First one flavor, then two, then three... Boy were we in trouble. And then MacOS 9 was replaced by OS X. And then came an ever increasing number of strange platforms. When I left, several MLoC had to run on a dozen platforms.
I bet one day that software will have to run on some 16bit embedded platform.
 
Xeo
@sbi The reason I'm compiling my stuff on both Windows and Linux whenever I can
 
@sbi: Well, quite a bit of my code has to run on 16-bit microcontrollers, so we're already there. :-P
 
Xeo
Not only for the prettier error messages from Clang
 
@sbi: That's why I try to code in standard C++ as much as possible, and bury platform details in some other compilation unit
Although that can get surprisingly difficult as these platforms do things very differently. :-/
 
sbi
9:59 AM
@Insilico Several 100kLoC of those several MLoC were an in-house library abstracting away what platform your app was running on. (This included it being a plugin in one of several popular applications.)
 
@sbi: Yup, that sounds just about right
 

« first day (496 days earlier)      last day (4466 days later) »