« first day (488 days earlier)      last day (4457 days later) » 

10:02 PM
@Ell what?
 
Ell
@AlfPSteinbach well my programme doesnt give any output (A simple hello world one) which was working fine before
its something to do with eclipse, but I dont know how to compile it on the command line. When I run it on the command line i get...
libgcc_s_dw2-1.dll is missing, but I don't know where that is and I don't know how to temporarily set the PATH variable :S
 
oh you're in Windows, and you're using Eclipse?
 
Ell
yeah. Thats two mistakes already ;)
using mingw
 
he he
do you know where the mingw installation is?
 
Ell
C:\Mingw32 I believe, I can find out anyway
 
10:06 PM
if command g++ --version works then you don't even need to know
 
Ell
it does
it was all going fine, I'm writing (attemping to) a 2d RPG game
 
to compile from the command line, just write
g++ hello.cpp
 
Ell
Well I can get that to work - im trying to link with SFML
it stopped working, so i reduced main.cpp to just a hello world programme, and that wouldnt work either
so i reverted what I did with linking sfml, but now it doesnt work :S
 
i haven't used SFML
 
Ell
well I managed to get it working before, it was just #include <SFML/whatever.h> and then -lsfml-graphics -lsfml-window -lsfml-system (I think)
and it worked, I got it in eclipse as well - although only a test project
but now it appears to compile fine but when i run it, eclipse just says the programme has ended instantly, without any error messages or anything
actually it returns -1073741515 instead of 0 but thats all i can get out of it :S
 
10:11 PM
well you can copy the DLL to the exe file's directory, or add the DLL directory to your PATH
or put the DLLs in a directory that is already in the PATH
 
Ell
I can't figure out how to set path :S temporarily I mean.
 
@AlfPSteinbach when did i stand behind myself?
 
set oldpath=%path%
 
i don't understand :(
 
10:12 PM
set path=c:\mingw32\something;%path%
 
how can one even stand behind onesself
19 mins ago, by Alf P. Steinbach
I think the one where he stood behind himself was great
 
@JohannesSchaublitb i think that was pic on your web page?
 
oh that one with 3 arms
 
So how and when and where are we going to set up the C++ F(requently)A(nswered)Q(uestions)?
I already have some to propose
 
you mean that? that's OOOLD
 
Ell
10:14 PM
@AlfPSteinbach thank you
 
6 years OOOLD!
 
So that guy has one hand, on his shoulder
 
@AlfPSteinbach why would my new pic be from 80's band?
 
don't know. it was just my association circuit kicking in.
a neural network can't always explain its conclusions.
 
10:16 PM
lol
 
Ell
@AlfPSteinbach cant find the .dll it wants :(
 
then ... they're elsewhere, i suspect
 
Ell
ughh things are so much easier on linux :P
 
10:18 PM
isn't it possible to link the thing statically, with oldfashioned static lib or object files?
 
Ell
erm I'm not entirely sure, I really don't understand linking :L
like whats the difference between static and dynamic? surely there is just a function at a certain address in the file, and when a programme needs it, they just jump to that address and off you go?
 
dynamic linking means that symbols are resolved to addresses at runtime (when loading the code)
static linking means that symbols are resolved to addresses when building the program.
 
Ell
ah okay. I also dont understand what a "symbol" is? :L as in function? class? or is there no concept of class once the programme is compiled?
 
these are orthogonal to "non-shared" or "shared" objects. you can create a statically linked shared library if you want
 
Ell
hmm okay
 
10:24 PM
@Ell i recommend "linkers and loaders"
guys is this valid in c++03 !?
char *x = +"hello";
 
Another riddle. I'd be tempted to say 'no', but I'm sure it is one of those C-compatibility snafus
 
Does char const[x] have an operator+?
Or const char*
 
is char *x = "hello" + 1; be valid!?
 
I don't think either is.
 
but if i add 0 ?
 
10:27 PM
I think it is
 
I think both are
 
Both are valid because it works for me
 
10:29 PM
@JohannesSchaublitb so what are we doing for the C++ SOFAQ
 
what's this
of course @Luc is correct. adding 0 to a string literal is valid
 
We're going to make a list of extremely frequently asked questions
and make reading it a prerequisite for asking a question with the C++ tag
 
okay, first would be t++ + ++u
or whatever it was
maybe
t++ + ++t
?
 
I already have like 8 written down
 
People who ask that question must be banned.
 
10:31 PM
cin >> stringvariable gives me an error
Did you #include <string>?

I get linker errors when using a static variable
Did you define the variable?

My program which manipulates C-strings crashes
Did you try to modify a string literal?

I'm getting some weird errors
WHAT ARE THE ERRORS

Why do I see an #include <blah.template> at the bottom of this header file that contains templates?

I'm using an STL container to store an array, why -
1. It's not the STL
2. You can't store arrays in containers (because they're not assignable), use std::array
 
But I'm not sure where to put it; can it go on the tag wiki?
 
the "typename" thing too
 
@SethCarnegie and "what is undefined behavior/is it bad?"
 
lol i have never seen such a question
 
10:33 PM
why does my variable print garbage / you never initialized it
 
the most asked question is "who downvoted me!?"
HMM it seems lambdas are valid in constant expressions. please discuss!
template<typename T> constexpr int f(T t) { return 0; } struct A { static constexpr int g = f([]{}); };
GCC accepts this!!
 
Aren't they only problematic in unevaluated contexts?
Although I guess it's unspecified whether they have a literal type and hence the snippet is not portable.
 
@Ell: try using code::blocks, there's a setup tutorial at sfml-dev.org/tutorials/1.6/start-cb.php
 
Ok, I added these:
What is undefined behaviour?
It means that you are doing something that the C++ Standard has declared should never be done.
If you do cause undefined behaviour, the results can legally be _anything_; your program can appear to work,
it can work sometimes and fail other times, it can crash, it can erase your hard drive, launch the
missiles, or buy pizza with your credit card.

I declared a variable like
int i;
and I'm getting garbage when I print it. Why?
You have to initialise variables before using them or you get undefined behaviour
 
gahh! I profiled my code comparing lower_bound on vector to a map: 98% of the time was spent in clock(). Hmm, time to rethink everything
 
10:37 PM
@MooingDuck comparing lower_bound on vector to a vector?
 
@SethCarnegie erm, to a map
that just can't be right
 
Ell
@AlfPSteinbach I was hoping i didnt have to resort to that but maybe i will :/
 
wait, if clock is a system call, and my data sets are tiny....
 
@MooingDuck you're benchmarking context switches or at least not what you wanted.
 
@sehe it dawned on me each of my tests would do a find on a set of 8 elements and then check the clock again. finding one element in 8 doesn't take long, but if clock is a system call...
@sehe yes, exactly
 
10:43 PM
@MooingDuck Why would you not (a) use far greater datasets (b) not check the clock (it will run without checking) and repeat the benchmark a few (hundred) thousand times before checking the clock. This is a comparative bench markt anyway, so absolute tick counts don't mean much
In terms of absolute profiling data valgrind/callgrind with kcachegrind would be a nice source of data
 
@sehe the vector thing is optimized for small data sets :( I usually run my tests for 1-5 seconds and display the count, because interpreting results is more intuitive.
 
@MooingDuck ok, but just don't keep checking the clock. That is not required, and just run 1<<20 iterattions. If it takes to long, 1<<10, too short? 1<<15 etc.: binary approximation of the desired order of magnitude
 
@sehe but I think I will in the future, consider me learned. At least until I forget
@sehe that's why I started with this method, I don't have to manually binary search something that's machine specific.
hmm, disk full, that's not good
 
Always make sure there is no IO (not even output to console) and you don't measure the preparation of input data/destruction of results (unless you really want to benchmark that too). Run headless. don't have other programs running. pin the process to a CPU core etc.
@MooingDuck That happens often on this list.
The C++ gild appears to be frugal on storage space
 
@sehe apperently I'd collected half a gig of performance info, onto my flashdrive
 
10:48 PM
@MooingDuck That just tells me that writing all that data is having a significant overhead on the benchmark itself. See ^^: "make sure there is no IO (not even output to console)"
 
@sehe I've never used the VS profiler before, I'm learning
didn't realize it was taking that much info, or that it was going to disk
 
Dec 28 '11 at 21:53, by sehe
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdc1             9.4G  8.9G   20M 100% /
Feb 7 at 19:59, by R. Martinho Fernandes
This was like, the last partition that I don't know for sure is borken and has had free space on it.
 
@sehe I remember both of those I think :D
 
:)
 
hmm, VS rebooted and now some buttons are missing. That's odd. I just used one before it rebooted....
nevermind, forgot what the icon was I guess
 
10:54 PM
Though, for some reason Martinho took a small week to fix his hardware configurations and I was done in under an hour and all without ever getting offline :)
 
@MooingDuck - sehe has some really good points there - I don't optimize unless I see callgrind output. Also, in my apps at least, 90%+ of the time, it's I/O that needs optimization (block reads and writes way outperforms any iterated I/O).
 
@MooingDuck You are using the profiler, and doing your own timing? Or, just do an infinite loop and press Ctrl-C to abort
 
@sehe The timing code is left over from before I started toying with the VS profiler.
 
@MooingDuck aha.
Another option is to have a background thread to Sleep(1000); std::terminate(); or something in that vein
 
hi guyes!!!
please help me with this topic:
0
Q: Test native x86 programs, building bootable images/drives

user1131997I have the next problem: I'm working with NASM and building some native and compiling it on this way: nasm - f bin source -o out I'm getting my native prograk for x86. And now the most interesting, how can I make it bootable and then test it? As I think there are 3 ways to make bootable ( but...

 
10:58 PM
@user1131997 I detect a bit overenthusiasm
@user1131997 Smells like drive-by linking --> newbie hints
I'm sure I recognize 1131997, though.
It could be from std::mt19937
 
mt = mersenne twister?
 
@Mysticial yes
 
@sehe why does it smell? If I want to ask how can I test my native programs - I can't ask it on SO?
@sehe I have troubles with writing to bootable sector in this topic
 
@user1131997 You can, and you did. You just don't need to link it here: newbie hints
 
@user1131997 you did, but linking to it in chat to make us help with no context isn't ... uh...
cosher?
 
11:00 PM
@Mysticial Precisely
 
Ahhh
I see
sorry :(
 
@user1131997 Did you know (trivia), that 1131997 is a prime number?
$ pyecm 1131997
Factoring 1131997:
1131997
 
@sehe no :)
 
@user1131997 Me niether, but I had a hunch, and lo and behold: it was one
 
@sehe impressive.
@sehe you had a hunch that it was prime? How often is that accurate for numbers that large?
 
11:03 PM
@MooingDuck well, it wasn't an out-of-the-blue guess - sehe associated it with a mt prime... ...quite impressive, nonetheless
 
@MooingDuck Not very often, let me tell you that. Now the interesting thing is, since we already know the standard avatars are being generated from some kind of hash of the user's email address, could it be that all anonymous usernames are selected from primes in a certain range (say 10000..100000000)
 
@sehe go on sehe, figure out what percentage of seven digit numbers are prime :D
 
@MooingDuck I think that is rather well researched
 
@sehe that seems like an unnecessary limitation of user ids
 
can we search on users "user*" or "user[0-9]+"?
 
11:06 PM
@kfmfe04 At least with the API's or the data.stackexchange.com
 
Argh!
[c:\Program Files (x86)\MinGW\bin]
> for %f in ("d:\lib\sfml\SFML-1.6\lib\*.dll") do @mklink /H %~nf %f
The system cannot move the file to a different disk drive.
The system cannot move the file to a different disk drive.
The system cannot move the file to a different disk drive.
The system cannot move the file to a different disk drive.
The system cannot move the file to a different disk drive.
The system cannot move the file to a different disk drive.
The system cannot move the file to a different disk drive.
It's actually the same disk.
 
@MooingDuck you're right that it's an unnecessary limitation - even if they want non-repeating random numbers, I'm pretty sure there are cryptographic functions that can give them to you...
 
@AlfPSteinbach Different partition/volume
 
@Mysticial - wow: +1 on this nice answer: stackoverflow.com/questions/9314534/…
 
@kfmfe04 Yeah. I hate the repcap. :)
Just curious (for statistics purposes), where did you see it?
 
11:13 PM
@Mysticial Congratulations! and another Guru Badge
 
@Mysticial probably recently active
 
Thanks! Yeah, Gurus and Great Answer badges are freaking hard to get... all about luck now.
 
ooh, I just figured out how to launch with the profiler pre-attached! :/ I really should find a website or book or something on this
 
And I just got the Great Answer badge for it. :) I'm trying to get back to work... can't concentrate... too excited... lol
 
Guess what! "The C++ programming language 3rd edition" came in today, I have it on my table as I speak :D
 
11:19 PM
@Mysticial no +1 from me :)
 
Awwww... :(
 
And, this is a massive book.
 
@Mysticial I'll wait till the residuals dry up
I'm guessing, 1, maybe two weeks?
 
@SethCarnegie Thanks!
@sehe Dunno... it could take while. I still have no idea when it'll slow down.
 
11:22 PM
Since we have long long, I propose the types int int, char char and bool bool
 
@Mysticial well, it's not yet 8 hours now
@SethCarnegie and tsk tsk tsk!
 
@SethCarnegie for 512, 256, and 128 bit numbers respectively?
 
@sehe I am sad. Please ask why.
 
@SethCarnegie isn't it technically long long int?
 
@Mysticial I'm still amazed at your "Why is one loop so much slower than two loops?" answer
 
11:22 PM
@Hoxieboy Why are you sad?
 
@MooingDuck yeah I guess so
 
I'm trying to remember how quickly this one shot up.
 
@sehe have repiled you :)
 
My computer programming class next year is using the java programming language, And I am just getting into C++ XP
 
IIRC, it was at 30 within 2 hours.
 
11:23 PM
@Hoxieboy oh, now I'm sad :(
 
rofl
 
@user1131997 "So what" is not in my opening book for winning games
 
@SethCarnegie That caught me by surprise too. It topped off at ~40 or so. Then it showed up on reddit.
 
@Hoxieboy Well, it is just a language
 
@sehe java is not a language
it's a disease
 
11:25 PM
Dropping a bombshell: I programmed in Visual Basic 6 for well over a year, and I'm proud of what I wrote. You can write good software in about any (rotten) language you can think of.
 
@sehe esoteric languages aside?
 
@Hoxieboy morale of story: it could be more fun, but it is not the end of the world
@MooingDuck Not even that.
 
Java isnt that bad of a language, considering the reasons it was implemented for
 
@MooingDuck I even programmed classes in assembly to link with Turbo Pascal 5.5. OO was all the new rage then (at least for Pascal) and they had the entire ABI specs open
 
@sehe Even Malbolge?
 
11:26 PM
@MooingDuck Ssssh
 
however, comparing Java to C++ is like comparing html to an actual programming language, it just isn't always right :s
 
I was thinking of writing a language that used only smily faces, so for instance :(blah) would print "blah"
 
@sehe Pascal and assembly are not Esoteric languages :D
 
because it's like the words in the smiley's mouth
 
@MooingDuck Well... Prolog then. But I haven't used if for anything serious. Lotus 1-2-3 macros were pretty rotten to work with
 
11:27 PM
@sehe "An esoteric programming language (sometimes shortened to esolang) is a programming language designed as a test of the boundaries of computer programming language design, as a proof of concept, or as a joke." en.wikipedia.org/wiki/Esoteric_programming_language
 
@MooingDuck Ok, definition refined, commit, ACK
I confess a deadly sin, and nobody even bothers to star me for it. I will never expose my soul again to you guys; you don't appreciate it :)
 
what the, what function is _free?
 
Can somewone help me with this ... ideone.com/plEoJ ? :)
 
@MooingDuck It's probably Microsofts misguided idea of 'supporting POSIX library calls'?
 
apperently 99% of my time is in _free
 
11:30 PM
@MooingDuck probably some internal implementation function
 
@MooingDuck You have a lot of free time :)
 
it calls __SEH_epilog4, 99%, RtlFreeHeap (0%), and __SEH_prolog4 (0%)
wait, SEH....
freakin...
 
Couldn't you call binary an esoteric programming language? XD
 
@MooingDuck That tells you... You're measuring way to much. You should try to limit the scope to your benchmark entrypoint
@Hoxieboy WTF is binary?
 
@sehe good point
 
11:32 PM
beg = clock();
for(unsigned i=0; i<SEEKS/data.size(); ++i) {
iter=a.find(shuffled[i%shuffled.size()].first);
}
end = clock();
 
@Hoxieboy binary would be a numbering system or encoding
 
simply stating binary as a computer's 1's and 0's showing current or no current, not something else entirely, like if a bulb is on or off
 
@sehe I think he means the level below assembly?
 
@MooingDuck aka machine language. Binary is just the notation, you know
 
@sehe yeah, that's the word that neither of us could recall
 
11:33 PM
But, you could write C++ in binary notation. That would be esoteric. Hysteric, even
 
@sehe took me a second to figure out how you'd compile that
 
totally agree with sehe on languages - I think there's usually something interesting to learn no matter which language I try...
some more than others
 
@MooingDuck Wrap the inner loop in a loop with large number iterations; Make sure the results get used (or the optimizer might optimize the whole loop away). One way it to increment a 'global' counter, declared as volatile size_t counter = 0;
 
@sehe oh right, I removed that part when I simplified everything to not clock so much :/
 
@MooingDuck Well, you'd use the dipswitches to implement a C++ compiler from scratch. After 7 years,you could do the first test program :)
@MooingDuck Not clock so much --> Just don't clock.
 
11:36 PM
@sehe I was thinking casting a char array to a function pointer and calling that.
 
@MooingDuck Oh you were on to the binary-encoded machine code. Well, it is commonly known as 'binary image'. Save it into a file, at offset 0x100 and name the file .com. Install dosbox and launch the application :)
 
2
A: Can constexpr function evaluation do tail recursion optimization

PubbyI've seen GCC perform this optimization. Here's an example: constexpr unsigned long long fun1(unsigned long long n, unsigned long long sum = 0) { return (n != 0) ? fun1(n-1,sum+n) : sum; } fun1(0xFFFFFFFF); Works on -O2, crashes otherwise. Surprisingly, it is also optimizing this: constexp...

HAHA
see comments
 
Sehe, what did you do this time?
 
Don't ask me why, but I still remember that the first 0x100 of code segment store the two FCB's (which were obsolete with dos 2.0)
@Hoxieboy Where?
 
@sehe lol nothing I just randomly couldnt connect to the chat for a few moments :)
 
Xeo
11:40 PM
Poor @Pubby
 
@Hoxieboy Oh, sorry I won't do it again
 
lol
 
hmm, my test is definitely broken. Most tests are taking 0 ticks, with a bunch of random ones taking 5000 or 10000 ticks
 
@sehe Great I can plink myself. I'm on authistic mode now, you can just ignore me :)
 
11:45 PM
@sehe Plink. Dont forget the others :)
 
@JohannesSchaublitb So what? The call is a constant expression, however implementation limits are reached.
 
@MooingDuck test?
sweet, I can reply to the message that is itself. That message is it's own reply
 
@MooingDuck Timing just doesn't work that way. You must take averages. Or use a CPU instruction/cache emulator (such as callgrind)
@MooingDuck Also, are you noticing that using the VS Profiler? Is it a sampling profiler or an instrumenting profiler? I guess it is sampling, and you should definitely approach the results statistically
 
@LucDanton NO
 
@sehe I am using the instrumenting one, but it can do either
 
11:47 PM
@LucDanton the guy talks about runtime crashes
but I asked about compile timexD the answer is completely wrong
ppl in #clang told me
 
Well yes. I know that. What about the comments though?
 
@MooingDuck I hesitated before hovering my mouse above that line. I expected it to melt one CPU in a tight javascript loop :)
 
@sehe mine didn't die :D
:2663206 I am unsupervised
 
@LucDanton we asked the guy who implemented constexpr for clang to give an answer xD
 
Would any agree that C++ is a higher language than C?
 
11:49 PM
@Xeo can confirm
 
@MooingDuck I found that out. Hand on the Ctrl-W combo :)
 
— an invocation of a constexpr function or a constexpr constructor that would exceed the implementation-defined recursion limits
Note that makes any use of a constexpr function possibly a non-constant expression though.
 
@LucDanton but that was not what i was asking.
 
@Hoxieboy Depends on the value of C, and whether the behaviour of integer overflow is defined. I think it isn't in C++ (IIRC)
 
@LucDanton yes but also UB
if UB happens it doesn't matter anymore whether it is or is not constant
 
11:50 PM
@JohannesSchaublitb I'm referring to your message that enjoined us to look at the comments. There is nothing interesting in the comments, is my reaction.
 
@Hoxieboy In fact, it first and foremost depends on the type of C :)
 
exceeding implementation limits is UB
 
11 mins ago, by Johannes Schaub - litb
see comments
 
in fact an impl could crash parsing {{}}
because of too many nested braces
 
VS's profiler isn't good with templates though. I think the function I'm interested in is test_internal<struct payload<8>,class associative<struct payload<8>,struct payload<8>,struct flexible_less,class std::allocator,class std::vector> >(class std::vector<struct std::pair<struct payload<8>,struct payload<8> >,class std::allocator<struct std::pair<struct payload<8>,struct payload<8> > > > const &,char const *,char const *)
 
11:51 PM
@sehe this book is pretty interesting O-O
 
0
A: Can constexpr function evaluation do tail recursion optimization

Richard SmithBy the rules in [implimits], an implementation is permitted to put a recursion depth limit on constexpr calculations. The two compilers which have complete constexpr implementations (gcc and clang) both apply such a limit, using the default of 512 recursive calls as suggested by the standard. For...

HAHA
 
@MooingDuck Yeah, I prefer doing stuff like this on Linux/GCC. nmap/objdump |grep test_internal` to find the mangled name, and pass that to callgrind or whatever tracer (iperf is nice too)
@MooingDuck I reckon MS will have tools to do the same.
@MooingDuck perhaps you can ideone the test prog?
 
gods he calls a 1000 line program "small"
D:
 
@Hoxieboy Well, for a program to do something interesting, you'd need a little bit more than that.
 
@sehe I'm sure the tests would make you throw up your arms in disgust
 
11:55 PM
@MooingDuck I should be heading to bed anyways. So, maybe next time
 
@sehe I wrote a 215 line civilization simulator in python D:
and that was the largest program I have ever written
 
@Hoxieboy ~1000 lines per file
and many files
 
@Hoxieboy I just checked the smallest program I wrote while I still consider it 'useful' and sloccount gave me:
Totals grouped by language (dominant language first):
cpp:           4656 (99.64%)
sh:              17 (0.36%)
 
@SethCarnegie it WAS a hobby program, but 1000 lines of code seems severe (though depends on what type of a program it is) let alone 100,000... then again, I AM getting into a more "proffesional" language?
@sehe 4656 lines?
 
@Hoxieboy yup
 
11:58 PM
@sehe what does it do?
 
Also, my current dayjob 'RFC' (rewriting a component in .NET/C# instead of Oracle PL/SQL):
Totals grouped by language (dominant language first):
cs: 27147 (95.51%)
xml: 1276 (4.49%)
 
-.- what program are you using to count the lines?
 

« first day (488 days earlier)      last day (4457 days later) »