« first day (396 days earlier)      last day (4554 days later) » 

7:01 PM
What's wrong with typedefs?
 
hmm
I think I ought to change my lexer
 
@KerrekSB I am a fan of using :P
 
now I did things like identifier++ as identifier + +
instead of identifier ++
 
@RMartinhoFernandes Ughh
@DeadMG Does your language support ++ i +++ i ++?
 
@KerrekSB Why "Ughh"? It's the same thing, just prettier (subjective) syntax.
 
7:04 PM
And http://www.stackoverflow.com
 
@KerrekSB lol
 
I'd probably get the compiler to error on it
 
@RMartinhoFernandes I'm still mentally biased against using. At the very least, it should come with a partner declaration abusing int = byte;
 
#define abusing using
There you go.
abusing namespace std;
8
 
@CatPlusPlus Sweet. abusing namespace std;
 
7:05 PM
lol
 
@CatPlusPlus Quite, indeed.
 
I think a series of using x = y; reads better than the equivalent in typedefs.
 
My laptop is starting to annoy me. Wireless doesn't work properly when the lid is closed. Battery drains when it's off and unplugged. And now, outdated video driver which crashes and does weird stuff, and finding an update is a nightmare. The model isn't even listen on Sony website.
I need to build meself a new desktop.
 
What's the name of the notation where you put the name before the type in a variable declaration?
 
7:08 PM
probably hacked together by some Chinese hackers
 
@StackedCrooked Prefix?
 
@CatPlusPlus Is it actually a Sony? That could explain all those symptoms...
 
@RMartinhoFernandes I think I remember something else also. I'll just look it up.
 
The GPU is supposed to be Radeon Mobility, but AMD installer doesn't detect it.
 
7:10 PM
It looks like nobody has voted in the election after the first six hours or so :-(
 
I now somehow found an update from Sony. It's still an outdated driver, but it's bit less outdated.
Yay, it's installing.
 
is it wrong of me to write a lookup table by hand?
 
you mean with pencil and paper?
 
no, I mean like, std::array<T, 256> result; result[L'.'] = ...; kind of thing
 
7:12 PM
@DeadMG Initialization lists?
 
VS doesn't support them
 
@DeadMG No need, that's just aggregate initialization
 
Here's a nickel. Buy yourself a better compiler.
 
lol
I'm implementing a better compiler
 
Yay, it's installed, and the driver restarted correctly.
 
7:13 PM
Worst case just make it T[256] result = { 1, 2, 3 };
 
@KerrekSB Is that some weird syntax I never saw?
 
Depends on the type of T.
 
T result[256].
 
yeah, you can't associate in aggregate initializers
 
@RMartinhoFernandes Yeah, I'm not sure what I was thinking.
@DeadMG You can always preprocess your data.
 
7:16 PM
Well, if there's no actual way of deriving the table, you have to write it by hand.
If there is, you can template your way out of it.
Or maybe not in VS.
 
lol
 
9
Q: Compute the CRC32 table at compile-time

FredOverflowThe reference implementation of CRC32 computes a lookup table at runtime: /* Table of CRCs of all 8-bit messages. */ unsigned long crc_table[256]; /* Flag: has the table been computed? Initially false. */ int crc_table_computed = 0; /* Make the table for a fast CRC. */ void make_crc_table(void...

 
I templated my way out of DRYolations in the parser and look where that got me :P
 
This comes to mind.
 
Well, if the data is static and fixed, and you want to store it in an array, then there must be way to sort it ahead of time.
Post an SO question :-)
 
7:17 PM
lol
 
What's a "dryolation"?
 
a violation of DRY
 
lol
 
7:19 PM
@DeadMG Feel free to answer recursively until the result resembles something an ordinary person might understand :-)
 
uh
you do know what DRY is, right?
 
@KerrekSB You mean you don't know DRY?
 
here's a question- is there an &&= or ||= operator?
 
@DeadMG Afraid not!
 
they seem kind of silly
 
7:21 PM
> When applied to object-oriented programs, the Law of Demeter can be more precisely called the “Law of Demeter for Functions/Methods” (LoD-F). In this case, an object A can request a service (call a method) of an object instance B, but object A cannot "reach through" object B to access yet another object, C, to request its services.
 
In software engineering, Don't Repeat Yourself (DRY) or Duplication Is Evil (DIE) is a principle of software development aimed at reducing repetition of information of all kinds, especially useful in multi-tier architectures. The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." The principle has been formulated by Andy Hunt and Dave Thomas in their book The Pragmatic Programmer. They apply it quite broadly to include "database schemas, test plans, the build system, even documentation." When the DRY princ...
 
Apparently, I sometimes violate the Law of Demeter.
 
There is a new edition of "C++ Primer Plus". Chapter 4: pointers. Chapter 17 or something: the STL... :-(
 
Ahhh. Ironically, my ignorance has incurred a dryolation on your part :-)
 
@DeadMG Think not. I think there's only &= and |=.
 
7:22 PM
@RMartinhoFernandes (Thanks for the quote, though I probably would have understood if you had just expanded the abbreviation :-).)
 
With the quote I learned about DIE!
 
a DIEolation
lol
 
@RMartinhoFernandes Did you meet your MAKER?
 
"Don't Invert Education"?
 
Duplication Is Evil. It's in the wikipedia page I linked.
 
7:23 PM
aah
 
Ah. D'oh.
So that'll make DIE! DIE! DIE! a legitimate comment now?
 
what I could really use is something like template<std::pair<T, typename>... enum_type_pairs>
 
@FredOverflow That book has a reputation of being good.
 
@StackedCrooked No, that's "C++ Primer"
 
@StackedCrooked You are confusing "C++ Primer plus" with "C++ Primer", aren't you?
 
7:24 PM
confusing for obvious reasons
 
@DeadMG Ah
 
The "C Plus Plus Primer Plus" has too many pluses.
 
@FredOverflow Apparently, yes.
 
If I ever write a C book, I'm gonna call it "C Primer plus plus", just to confuse people.
 
also
std::array should default-initialize it's contents, right?
 
7:26 PM
Not sure.
 
No, why should it? It's a POD (assuming its element type is POD).
 
@DeadMG excuse me?
 
ahem
 
Common typo.
 
7:26 PM
@DeadMG array is precisely an aggregate. It's identical to T[N].
 
ok
so what is the default-constructed value for an enum?
 
@DeadMG You can do template <typename T, T... ts> for a helper and then invoke that with T = pair<U,V>
 
ok
 
@DeadMG enums don't have constructors
default-initialize is "no initialization", value-initialization is zero.
 
Not the first enumerator?
 
7:28 PM
Even though zero might not even be a good value!
 
@CatPlusPlus No, zero.
 
That's a bit silly.
 
`enum E { A = 1, B = 2 }; E x; //ouch
@CatPlusPlus Enums are a "bit silly" if you will :-)
 
@KerrekSB x won't be initialized at all here, not even to 0. Unless it's a static object, of course.
 
heya
I am dissapoint.
None of you applied to be a mod :O
 
7:29 PM
@KerrekSB You know what's really "a bit" silly? bitfields ;)
 
I want a value which won't be a valid enumerator
 
@hexa @awoodland did. @Moshe, too.
 
@hexa Why would we? We're perfectly happy the way things are in C++ world.
 
@hexa @awoodland did.
He's over there on the Town Hall Chat right now.
 
I'm writing a LUT of enums and I really need something which is "Not found"
 
7:30 PM
Also I couldn't care less about being a mod.
 
Sorry, I meant E * p = new E() or something like that.
 
I don't know @awoodland :(
 
@DeadMG How about 0 or -1?
 
Or E x((E());
 
@DeadMG enum bool { true, false, file_not_found };
 
7:30 PM
@DeadMG OMG you have FileNotFound in your enums?
 
lol
 
@KerrekSB That looks somehow executable :)
 
it's not in the enum
in the LUT
 
@KerrekSB E x{};?
 
@FredOverflow Nicely spotted :-)
 
7:30 PM
@DeadMG Show us the definition of the LUT.
 
@RMartinhoFernandes Of course!
 
I need something like if (lut[lookup] != SomeMagicShit) { doShit(lut[lookup]);
 
Or E arr[10]();.
 
Don't include missing values in the LUT?
 
7:31 PM
@DeadMG How about std::array<boost::optional<T>>?
Assuming the LUT is dense. Otherwise, just use an std::unordered_map<T>.
 
nah, that's a waste, it's known at compile-time which values are in or not
 
CRC table?
 
Use a Boost.MPL table!
 
Then have a second array of bits that indicate which values are "real" and which are "absent" in the actual LUT.
 
click the pastebin, it has the definition in
 
7:33 PM
unordered_map is a waste while filling 20 of 256 values is not? :P
 
Can't you just add an Absent value to Wide::Lexer::TokenType? Like -1?
 
could do, I guess
that'd be kinda uglytastic, though
 
Well, you cannot have your cake and eat it, too. Unless you order two cakes.
 
Well, you cannot have your cake and eat it, two. Unless you order too cakes.
Damn, you fixed it.
 
ideone seems to think they'll all be 0
that's fine by me
 
7:36 PM
@CatPlusPlus Not if you define a good hash function and make only 20 buckets. But the hash function would essentially be a lookup table again.
 
"What time is it?" - "2 minutes before 2." - "Great, on my clock, it's two to two, too!"
 
@KerrekSB Er, I was referring to std::array with most of the values missing.
 
what, 2 to 22? that's 2 to 10pm?
 
Who said anything about 22?
 
What's this pm you speak of?
 
7:37 PM
@CatPlusPlus I thought you were talking about an efficient unordered-map...
 
Also there are tools to generate perfect hash functions for given set of things.
 
@RMartinhoFernandes Pre-menstrual. Also, a magazine.
 
well I think having most of the values missing is fine, it's a regular array, looking up into it will be the cheapest operation in the history of the universe
 
I once had a boolean joke. It was funny because it was true.
 
I once had a boolean joke. It was funny because it was FileNotFound.
 
7:38 PM
The UDP joke posted here recently was quite funny. Anyone got it?
 
@CatPlusPlus Yes. If you're terribly clever, maybe you can find a function that will be a one-to-one mapping of your character collection to [0,20)...
 
Today, one of my students returned false from a function with a std::string return type. Anyone want to take a guess what happened? :)
 
compiler error?
 
Wishful thinking.
 
@FredOverflow You should so post that as a comment on this question!
@FredOverflow implicit conversion to a string of length 1 containing one null?
 
7:41 PM
I have another CG assignment to do for Friday.
The spec is fucking terrible.
 
CG?
Computer Graphics?
Code Golf?
 
Yes.
Eclipse starts so slowly.
 
Eclipse starts?
 
Eclipse starts so slowly, even your mother's up before it.
 
Third assignment is actually 3D stuff.
 
7:44 PM
Makes sense.
Maybe the next one will have 4D stuff.
 
This one is 2D, one variant is about color spaces and the second is about transformations.
But I can't really tell what the hell exactly it's supposed to do.
"Prepare a file with vector shape. Any format, as long as it can modified." Fine. Should it support only lines, or more stuff? Doesn't say.
 
@KerrekSB No, implicit conversion to a string of length 0.
 
:abbr tempalte template There fixed for me.
 
:abbr you me
 
@RMartinhoFernandes Speaking of, I've often wondered how one might make a real-time first person simulation that implements special relativity.
Like, with a very small value of c.
 
7:49 PM
:abbr ev iate
 
@FredOverflow True!
 
@FredOverflow :abbreviate tempalte template works. :abbr is an abbreviation of the :abbreviate command.
 
@KerrekSB Is that like, 2 + 2 = 5 for very large values of 2?
 
@DeadMG Yes, but no. c is just a dimension-ful parameter.
Making it slow allows for the simluation to produce a perceivable difference to a classical (3+1)D approximation.
 
Right, because you can hardly tell the difference until you go past around 0.7c.
 
7:51 PM
You know what? Tomorrow's Thursday. I'll do it tomorrow.
 
The biggest obstruction I came up with is that you are essenitally forced to maintain 4-dimensional world data.
 
There, problem solved.
 
@RMartinhoFernandes yeah
So the complexities are immense.
 
Now for something interesting.
 
template <bool C, typename T = void>
using better_enable_if = typename std::enable_if<C, T>::type;

template <typename X>
better_enable_if<sizeof(X)==1> f() {}
Awesome?
 
7:53 PM
Neat.
 
@RMartinhoFernandes Noteworthy.
 
That's "just" to get rid of the typename and ::type, right?
 
Ok confused?!?!?!
What's the CodeReview SE for anyway
0
Q: spoj GETTING WRONG ANSWER

user1044137link to the problem is http://www.spoj.pl/problems/ELEVTRBL/ i am implementing the problem using bfs..please provide test cases where my code fails.....is there any better way to do the problem. I am applying bfs and the order of my solution is O(number of floor) #include<stdio.h> int a[...

 
We can tell by the amount of punctuation.
For reviewing code.
 
7:55 PM
@Xaade Post code, get feedback
 
So, not working isn't a codereview?
 
For finding subtle bugs in working code. For questioning design decisions.
 
If it's not working, it's SO material.
 
Ok.
That clears it up.
 
Though I don't agree with the migration.
 
7:56 PM
But, usually.... here code, not work..... is closed shortly on SO.
 
It violates "Don't migrate crap".
@Xaade Exactly. It was a bad migration.
 
@Xaade What about template metaprogramming where the compiler errors are the actual output. Does the code "work"? :)
 
Do we have a mod ability, "Return crap."
 
It was migrated by mod.
 
@FredOverflow Then they wouldn't be asking (This doesn't work). They would be asking (not expected output). But that's not working too. Ok, I'm confused again.
Is the template metaprogram with compiler error as output qualify as "subtle bugs in working code" if it fails to produce the correct output?
@CatPlusPlus Migrated by "their" mods. Our mods hit [Return to Sender].
 
7:59 PM
@Xaade "Here, I wrote this code, my problem is solved. But I feel the code isn't great." <- CodeReview. "Here, I'm trying to solve this problem, but I'm not able to do this part" <- SO.
 
Yeah, let's play ping-pong with crappy posts.
 
2 mins ago, by FredOverflow
@Xaade What about template metaprogramming where the compiler errors are the actual output. Does the code "work"? :)
@CatPlusPlus Yay... free flag weight.
 
@Xaade ?
 
No, return to sender locks out a migrate back to the wrong place.
No more ping pong
@FredOverflow @RMartinhoFernandes If compiler error is output, the line between "this is working but" and "this is not working" is VERY blurry.
 
I really don't care where they'll be closed.
 
8:03 PM
@Xaade Well, I think it could be argued for both.
in Town Hall Chat, 53 secs ago, by yoda
As a Stack Overflow moderator, how will you deal with Jedis who defect to the Dark side?
 
I say Patience
 
What dark side? Java?
 
yoda is talking about java right?
 
first!
 
hahaha
 
8:05 PM
@FredOverflow You misspelled "frist".
in Town Hall Chat, 21 secs ago, by Xaade
What if a mod becomes evil?
 
int a = 1;
int becomes = 0;
a % becomes; // evil!
 
I knew it! I knew @Fred was going to come up with a joke delivered in the form of code.
 
enum Moderator { good, evil }; Moderator a; a = evil;
 
in Town Hall Chat, 1 min ago, by Xaade
Do any of the candidates have experience with the language Brainf_ck?
 
It's Bra*nfuck.
 
8:09 PM
I didn't do it.
Jeff Atwood earns title: "Censor Ninja"
 
We Germans call this "Studentenfutter". Do other people call this "student food" as well? :)
 
No, we call that "raisins" and other stuff I can't identify.
 
probably nuts
I see Hazel and Walnut and Cashew and Almond.
@RMartinhoFernandes Ah, like the South Park episode :)
 
:( I don't watch South Park.
 
Walnuts look like brains. I should eat more of them.
 
8:15 PM
Townhall seems like a copy of the C++-Lounge...
 
@FredOverflow Are you a mindflayer?
In the Dungeons & Dragons fantasy role-playing game, illithids (commonly known as mind flayers) are monstrous humanoid aberrations with psionic powers. In a typical Dungeons & Dragons campaign setting, they live in the moist caverns and cities of the enormous Underdark. Illithids believe themselves to be the dominant species of the multiverse and use other intelligent creatures as thralls, slaves, and chattel. Licensing The illithid is considered "Product Identity" by Wizards of the Coast and as such is not released under its Open Game License. Publication history Mind flayers were ...
 
Oh, I didn't see the "show more" button.
 
If I were running for moderator, my slogan would be "One FAQ a day keeps the doctor away".
 
Silly wikipedia article barely mentions eating brains.
 
in Town Hall Chat, 54 secs ago, by Xaade
@MichaelMrozek There's some merit to the idea that a mod can't always classify content when they have little to no experience in a language. If the mod tools don't benefit a mod interesting in a top x tag, then the mod tools are deficient. So, your argument is after the fact, and doesn't discuss the real issue.
 
8:17 PM
eew, politics
By the way, "C++ Primer plus" mentions a C++99 standard... :)
 
Can we not talk about the silly mod elections.
 
lol
 
This is silly. You can place bounties to "reward an existing answer". But you have to wait 24 hours to actually reward it.
 
Because there might be a new existing answer!
 
8:21 PM
But I want to reward the one that exists!
I can place another bounty if I want to reward a new one.
 
Well, you clearly don't know what you're doing!
 
I know what your mother's doing- it's me!
 
@RMartinhoFernandes Just because you can now annotate your bounties doesn't mean that their nature has changed...
@DeadMG Lame. I would have expected you to get her to check your grammar rules.
 
my grammar is perfect- I wrote it
 
8:28 PM
Since when are you Mr. Perfect?
 
@Xaade - I can't see your message in there, but yes I wrote a BF compiler (when I was taking syntax topics and analysis) and added parallel extensions to the language
 
since I was born
 
@FredOverflow Is that NSFW?
 
Not suitable/safe for work (NSFW), not work-suitable/safe (NWS), or not school-suitable (NSS) is Internet slang or shorthand. Typically, the NSFW tag is used in e-mail, videos, and on interactive discussion areas (such as Internet forums, blogs, or community websites) to mark URLs or hyperlinks which contain material such as pornography or profanity, which the viewer may not want to be seen accessing in a public or formal setting such as at work. NSFW has particular relevance for individuals making personal use of the Internet at workplaces or schools which have policies prohibiting (even...
@RMartinhoFernandes That?
 
Yeah, that.
 
8:32 PM
It's not porn, if that's what you're asking :)
 
Well, pictures of scantily clad women are sometimes considered NSFW, even if not porn.
 
Well, you can see his nipples...
 
5
Q: Mutable, (possibly parallel) Haskell code and performance tuning

hakojaI have now implemented another SHA3 candidate, namely Grøstl. This is still work in progress (very much so), but at the moment a 224-bit version pass all KATs. So now I'm wondering about performance (again :->). The difference this time, is that I chose to more closely mirror the (optimized) C im...

OMG, this is way too hardcore for me.
 
runST hints at the state monad
 
Yes, that's usually related with mutable code.
 
8:46 PM
@FredOverflow here, that term usually describes pasta with ketchup :p
 
@FredOverflow Is that Mr Perfect?
@FredOverflow It think nipples that are visibly protruding are OK as long as they are covered. And men's nipples are always allowed. Or is that a ..? Oh.
> Clojure's approach to concurrency is characterized by the concept of identities, which represent a series of immutable states over time.
^ How is this different from stateful programming?
 
It has a fancy name.
 
pretty much. :P
 

« first day (396 days earlier)      last day (4554 days later) »