« first day (320 days earlier)      last day (4619 days later) » 

9:02 AM
Can anyone have a look at this project and tell me the quality of code ?
in terms of bad practices, performance and security issues.
 
you're asking about VB code in a C++ room?
 
what a shame :|
@TonyTheTiger my bad, I was search for C++ webserver with php and found that, I just went through introduction.
 
oh I see
 
anyways
anyone know a simple webserver in C++ that supports php ?
 
@sbi Hey baby
 
9:08 AM
@OmeidHerat webtoolkit.eu/wt ( a library for writing web stuff in C++ )
 
sbi
@ManofOneWay You at work? :)
 
@sbi At school =)
 
@ManofOneWay should I get worried now?
 
@TonyTheTiger About what?
 
@ManofOneWay about you saying "hey baby" to another guy...
lol
 
sbi
9:10 AM
@TonyTheTiger It's called a "fool's license."
 
@TonyTheTiger ;)
 
@TonyTheTiger that ain't what I am looking for mate.
 
@OmeidHerat oh ok, I have no idea then
@sbi not sure what that is...
 
but thanks anyways
 
@OmeidHerat: Use one of the well know web servers. I have had good success deploying small stuff using LightTPD.
 
9:12 AM
@sbi no offence but if a guy says 'hey baby' to another guy its gay under any license what so ever (bromance excluded).
 
@OmeidHerat What about babies?
 
5 mins ago, by Man of One Way
@sbi Hey baby
 
sbi
@TonyTheTiger Fools are allowed to say anything on account of them being fools.
 
oh I see
 
sbi
@OmeidHerat And what would be wrong with someone being gay?? I'm not homophobic at all. (And in case you are: I sired more kids than many here had girlfriends. So stop looking that way at my avatar. It's not going to rape you.)
 
9:15 AM
@wilx that looks interesting.
I wonder why google is not using they are own server but this for youtube ?
@sbi take a chill pill mate, though I am not homophobic even if I was you said that to @TonyTheTiger and he had some concerns about that.
but anyways
 
did I start another argument?
 
sbi
@OmeidHerat I have a hard time parsing that sentence (you might want to throw in a bit of punctuation), and the one interpretation I came up with doesn't fit the facts. So would you care to elaborate?
 
</argument>
 
@TonyTheTiger I believe I did by saying Hey baby
 
lol
@ManofOneWay lol
 
9:19 AM
that close tag is a web developer thing I am not sure if you guys get it or not.
@sbi No.
 
yea, we might not be web devs, but most of us can interpret these things
 
@sbi that sentence is as simple as abc.
 
sbi
@OmeidHerat <sarcasm> We've never heard of tags here. </sarcasm>
 
Gosh, I find that offensive.
 
sbi
@RMartinhoFernandes That?
 
9:20 AM
huh?
 
@sbi > I am not sure if you guys get it or not.
 
for peace lol
 
sbi
@OmeidHerat Oh, so you want to elaborate? (You might want to keep in mind that few here are natives.)
 
(TBH, I don't find it offensive, just being a jerk.)
 
@RMartinhoFernandes tell us something new
 
9:22 AM
@TonyTheTiger nice one!
 
sbi
@RMartinhoFernandes No explanations needed, we now you're a jerk.
OH NO! NOT AGAIN!
 
@RMartinhoFernandes now that is offensive, and you got flagged.
others might consider to flag that as well.
 
@RMartinhoFernandes you can always go to r/circlejerk for jerking
 
yesterday, by R. Martinho Fernandes
Recently someone suggested I should be more of a jerk.
Should I assume this is not a good idea, then?
 
@OmeidHerat huh? You being serious?
OMG, NOT FLAGWARS AGAIN!!
 
9:24 AM
alright alright
what was my issue
why I am here in C++ ?
ok
 
sbi
@OmeidHerat Yeah, right. The whole of the chat has to consider this, if you flag anything.
They all see this. None of them know the context. They all have to decide whether the flagging was valid. And they are all annoyed.
 
ok I am looking for a simple piece of code or open source webserver that supports php ?
 
meh, but C++ that supports PHP sounds wrong
 
@TonyTheTiger Yeah, that's because it has the name "PHP" in there ;)
 
sbi
@TonyTheTiger Youc an leave C++ out of that. PHP just sounds wrong. I mean, it's close to "Pfft!"
 
9:26 AM
Screw PHP.
 
@OmeidHerat I'm afraid you're in the wrong place for that...
 
I am looking for a webserver code.
 
If you're trying to write a webserver, then stop trying.
 
a webserver that can support cgi so I can deploy PHP on it.
I am not talking about php code.
@CatPlusPlus why ?
 
CGI is awful deployment model.
 
9:28 AM
@CatPlusPlus could be.
tell me a better one ?
 
It was barely appropriate 20 years ago, certainly not now.
 
that I can deploy php on a c++ webserver.
 
First, you need to get rid of PHP, because it's utterly broken. Then, AJP or SCGI are good.
 
map<map<string, int>, map<string, std::vector<int> > >
I'm just gonna leave this here.
 
why?
a map of maps?
 
sbi
9:29 AM
@RMartinhoFernandes That wouldn't compile for at least three reasons.
 
@sbi Three? I'm embarassed but I can only see one.
@TonyTheTiger And with maps as keys!
 
@CatPlusPlus so much of fannboism and PHP-phobia,
 
@CatPlusPlus PHP is gold, and its not responsible for crap code that so called cheap developers write.
 
Are maps orderable?
@OmeidHerat It's not gold. It's not even bronze.
 
9:31 AM
Peat perhaps?
 
Official implementation is crapload of broken code, and the language itself is no better.
 
sbi
@OmeidHerat I think that, by now, you have managed to make an uncongenial impression on just about everyone here. Can we now show you the door, please?
 
Ask our conversation bot here to link you to my previous rants, if you're really interested.
 
@sbi no thanks.
 
9:32 AM
I'm going to stop repeating myself now.
 
@CatPlusPlus I don't think so, how does an operator< even make sense for a std::map
 
@TonyTheTiger Try inserting.
 
@CatPlusPlus Well, that still compiles :P
 
sbi
@OmeidHerat <plonk/>
@RMartinhoFernandes There's 1) a missing std:: before every map and 2) one before every string. I thought error #3 was that maps can't be used as map keys, but it seems @Tony has shown I was wrong.
 
@sbi that is </plonk> mate.
 
9:35 AM
@sbi Oh. I didn't consider the missing std::s. I assumed using std::map; using std::string;, or perhaps the more hideous using namespace std;.
 
sbi
@TonyTheTiger It's not at first look, because it's using namespace std. And that is bad.
 
WTF, there is a operator< for maps.
 
Well, there must be.
 
@sbi I did that for convenience and saving myself typing, but I'm sure it makes no difference to wether or not this works? Or does it
 
9:37 AM
@KillianDS std::map requires a strict weak ordering, not a total order. I believe return false; is a valid implementation.
 
well
 
sbi
@TonyTheTiger Remember: All huge software products started out as such snippets, and, underneath, they still are such snippets. And see what using namespace std might do: stackoverflow.com/questions/2712076/how-to-use-iterator-in-c/…. It's just not worth it, really.
 
@sbi yea I got the point
 
sbi
Haha, Debbie is great again, today.
 
that better?
 
9:42 AM
Wait!
operator< for std::map defines a total order!
It's evil.
I'm gonna post a comment on the question.
 
how does that make it evil?
 
@TonyTheTiger Maybe I exaggerated.
:)
 
sbi
@TonyTheTiger Yeah. And this even more.
 
You can't modify a std::map's keys can you?
 
sbi
9:46 AM
@RMartinhoFernandes No.
 
Yeah, not evil.
 
@sbi oh, didn't think about the typedef ... makes it clearer yes
 
sbi
@TonyTheTiger Yeah, typedef is like const in that it is a great, but underestimated tool.
 
Lunch time, see you babes!
 
So, containers can have operator< defined in terms of lexicographical_compare. And std::map is one of them.
 
9:48 AM
std:set also
 
@sbi for some reason I thought it's use was not considered to be a good thing, I thought I'd read that somewhere
however it seems I'm wrong
 
I wish I could have strong typedefs too.
 
strong? In what sense?
 
sbi
@TonyTheTiger Unfortunately typedef is not as good as it could be (despite it's name it doesn't define new types, it only creates new names for existing ones), but it's still pretty handy to use.
@TonyTheTiger See my message ^
 
hmmm yea
@sbi so it creates an alias more then a type
 
9:51 AM
Go has that, btw.
 
Yes.
Yeah, Haskell-like newtype would be nice.
 
BOOST_STRONG_TYPEDEF?
 
Yeah, I saw that.
 
sbi
@CatPlusPlus No matter what you ask for in C++, if it's a hard case, in 90% the answer is "boost". (Another 9% is "not possible".)
 
@Alf: thanks for the quote, but does "contiguous array" guarantee that there's no padding around the outside of the data in the std::array?
 
10:04 AM
no
or, yes
sorry
you get that guarantee from the guarantees of sizeof operator
definition for array
 
@AlfPSteinbach How do you mean?
Oh, sizeof(array<T,N>) == N*sizeof(T)?
 
yes
assuming meaningful question
 
That is guaranteed?
 
10:06 AM
no
 
I believe that it is guaranteed with C++11 and likely to be true with C++03.
 
Interesting. I think earlier we even thought that int[4][5] isn't required to be totally contiguous, it just usually comes out that way.
 
the guarantee of the sizeof operator applies to raw arrays
 
@AlfPSteinbach Ah, but std::array<T,N> is not a raw array.
AFAIK, it can be padded.
 
it says sizeof( array of N elems of T ) = N*sizeof(T)
if question is meaningful, re meaning of "around", then we're talking contiguous
 
10:10 AM
some new people.
Nice!

I am looking for a webserver in C++ that I can deploy PHP on it ?
any ideas or pointers where should I start ?
 
But if std::array has padding, you can't treat the buffer of a `vector<array<N,10>> with 10 elements as an array of 100 Ns.
 
@AlfPSteinbach Thanks heaps, minGW worked like a charm!
 
Maybe I'm mistaking "contiguous" for something else.
 
@R. maybe not, im' not sure what you mean by "around"
there are 2 possible meanings
 
I didn't use the word "around".
 
10:13 AM
like talking about around each element in the std::array, that's meaningful, and answer is no, no such padding.
 
Oh, no, not that. I'm talking about padding in std::array after the internal raw array.
 
No, not around each element, but around the entire array
 
Like, sizeof(std::array<char,7>) could be 8.
 
well not around but at end you can easily demonstrate that there must be padding
 
I.e. the data inside the array, &x[0], is contiguous, but the entire array may be bigger
 
10:14 AM
since std::array supports size 0
he he
also e.g. on nearly all machines an array of 3 chars will have padding at end.
 
That's a degenerate case, though :) There's a partial specialization for that, no?
 
but then we still talk about contiguous array of such objects
 
so the question is if you have array<array<T,N>,M>, what is &x[0]? Is it guaranteed to point to M*N contiguous units of T?
 
otherwise it would be impossible to e.g. have contiguous buffer for std::vector in all cases
 
@AlfPSteinbach I think you're missing the point.
 
10:16 AM
yes by 23.3.2.1
 
@AlfPSteinbach So with T = array<char, 3>, T[10] is not 30 contiguous bytes?
 
it is probably 40 bytes. contiguous.
in the standard's sense.
 
It doesn't point to 30 contiguous units of char, then.
 
for example, a std::vector<T> of size 10 has by definition a contiguous buffer
which in practice would be at least 40 bytes here
 
10:18 AM
@AlfPSteinbach But it's also about finding your element. Is x[5][2] the same as y[25], etc.
 
Where T x[10], and T * y = &x[0] in the above example
 
Wouldn't y[25] that be UB there (even if there was no padding in sight)?
 
1
Q: Protection for "early access" builds

AnteruI have a C++ application which I want to release to a bunch of testers (<10.) I need some simple way to limit those testers from distributing it further. There's no need for super-duper hack-proof protection here, but it should be impossible for normal users to circumvent the protection. I can...

Lol.
 
hm let's just look at differences
 
Als
10:22 AM
Okay all the animals are in.
 
first, a zero size std::array does not have zero size
it is at least 1 byte
 
int main()
{
    std::array<char, 3> a[10];
    std::cout << sizeof a << std::endl;
}
@AlfPSteinbach This prints 30 on my system, not 40.
 
so it does not adhere to requirement of raw arrays that size must be N*sizeof(Element)
 
@RMartinhoFernandes Well, if the memory were contiguous, it should point to the correct location.
 
@KerrekSB Yes, yes, but you can't index past the end of the array, right?
 
10:24 AM
@fred: try std::array<char, 0> a[10];
 
@RMartinhoFernandes ...or can you? :-) No, in principle you're right of course, but in the context of whether T[N][M] is contiguous, how else would one describe contiguousness within the language?
 
@AlfPSteinbach 10 bytes, because every object is at least 1 byte.
 
@FredOverflow That's all nice, but is there a definitive answer? Is it required behaviour, or just up to the implementation?
 
@KerrekSB The 30 part or the 10 part?
 
@FredOverflow The 30 part
 
10:26 AM
I don't see why it would be 40 instead of 30. There is no padding required when storing chars, so C++ will never insert padding.
 
The zero-array part is moot, because an array of arrays of zero elements still has zero inner elements, so the question of how to find any one of them is vacuous.
 
Of course, this isn't really relevant, because you can't treat a 2D array as a large 1D array without invoking undefined behavior, right?
 
@FredOverflow I guess that was the OP's question...
 
@FredOverflow Oh, consider std::array<T,3> a[10], where sizeof(T) == 3, then.
sizeof(std::array<T,3>) is not required to be 9.
 
@RMartinhoFernandes If sizeof(T) == 3, then T can only be composed of three chars, right?
 
10:28 AM
Or I don't know, maybe he just wanted to know if all the memory was next to each other, without wanting to "flatten" the addressing.
 
@FredOverflow One char and one uint16_t?
 
@RMartinhoFernandes really?
@RMartinhoFernandes The sizeof of that would be 4, not 3. sizeof includes padding.
 
@FredOverflow If it is, please show me where. I can't find it :(
@FredOverflow Dammit.
 
int main()
{
    std::array<std::array<char, 3>, 3> a[10];
    std::cout << sizeof a << std::endl;
}
prints 90 here
@RMartinhoFernandes The standard essentially says that padding is necessary to align primitive types on their storage boundaries. If you only deal with chars, there is nothing to align.
 
@FredOverflow So the compiler extensions that disable padding cannot possibly be conformant? Id est, padding is mandatory?
 
10:32 AM
@fred: there are machines that don't like odd addresses. faster to fetch a 4-byte word then 3 individual bytes.
 
anything can be handled as individual bytes, but at the cost of inefficiency
 
0
Q: May I treat a 2D array as a continuous 1D array?

FredOverflowConsider the following code: int a[25][80]; a[0][1234] = 56; int* p = &a[0][0]; p[1234] = 56; Does the second line invoke undefined behavior? How about the fourth line?

Doesn't involve the padding issue, but I'm not too interested in that, anyway :)
@AlfPSteinbach Okay, but then sizeof(std::array<char, 3>) would be 4 on such a machine, right?
 
i thought it would be even on the PC, but I was wrong about that
however there once was Windows NT for different architecture
and you could set error handling behavior of process to avoid the sloooooow recovery for unaligned access or odd address
 
@FredOverflow Excellent. Can we use any of this for std::array?
@Alf: How can I get rid off your downvote? Shall I rephrase the first sentence into "The stack is an implementation detail that's not relevant to the situation"?
 
10:42 AM
@KerrekSB Well it is very relevant, since it is an allocation/deallocation policy that beats dynamic allocation by many orders of magnitude (in speed).
@KerrekSB And it is also relevant because in practice it imposes limits on object sizes. Like, very large arrays not a good idea.
but mainly i downvoted because the statement was incorrect
i would probably not downvote merely because of a misleading opinion
so if you just rephrased to something not incorrect i'd remove downvote, but perhaps add comment ;-)
i would have to search old discussions to find the silly "stackless" machines
they didn't really do without a conventional machine stack
but they were optimized for single process execution where the process only saw a kind of "window" in the registers
it was a very stupid thing to do
because each context switch then required copying a lot of register data
 
But even the question "is this array on the stack" is misguided - it really all depends! It could be a global, or it could be part of a dynamically allocated object.
 
so that the optimization in the end turned out to slow down them machjines
yes
 
So the first thing to say is that a "stack" isn't a good way to think about this. What the OP is really after is whether the array class performs any allocations of its own. Which it doesn't.
OK. Reworded that.
Also encouraged the OP to ask about the contiguousness in a separate question
 
11:01 AM
0
Q: Can wrapping a type in a struct cause additional padding?

FredOverflowGiven any type A and the following struct: struct S { A a; }; Are there any cases where sizeof(S) is greater than sizeof(A)? For example, can sizeof(std::array<T, n>) be greater than sizeof(T[n])?

 
11:26 AM
@FredOverflow is this a "can the size legally be different according to the standard", or "would it ever actually happen under any compiler on any hardware whatsoever"?
 
@jalf First one. He said so in the comments.
 
ah
 
Which one is British: "specially" or "especially"?
 
@RMartinhoFernandes The first one sounds retarded.
Not that British isn't retarded, but I'd go for the second one.
 
isn't the compiler in general allowed to insert padding when it likes (not counting the beginning of a struct and one or two other cases where it's not allowed)?
 
11:36 AM
I've never heard/seen/read 'specially' used as 'especially'.
 
What's the difference?
I thought it was the same thing, except for the side of the Atlantic.
 
@jalf I don't know, that's why I asked the question.
 
spocially => cia spy lol
 
But "specially" looks cleaner to me, being "adverbification" of "special" by suffixing -ly.
 
11:39 AM
Especially is better.
 
Does "better" mean British in this context?
I'm trying to standardise my usage of English, and I picked Europe, for no particular reason.
 
I think both are correct in BrE. But then again, who cares.
I try to use BrE, but TBH I don't know half of the differences between different variants, and just use words that first come to mind.
 
Oh, there are two new short C++ videos on Channel 9.
 
11:42 AM
You don't care because you're a cat. I care because I'm a robot. ;)
9
Q: "Specially" vs "especially"

MidhatWhen should each of them be used?

 
@CatPlusPlus Do you prefer initialized or initialised? :)
 
Ok, so they're not the same after all.
 
Initialised. That's the one of the things I know about. :P
 
I am looking at .NET assembler instructions. Is that a stack based VM?
 
11:45 AM
@CatPlusPlus colour or color? :)
neighbour or neighbor? :)
 
Colour.
 
So, they do not have any registers and they put everything on the stack?
 
@wilx In the intermediate language, yes. But that is JIT-compiled to x86 before it is run.
 
@wilx in the .NET VM, yes. When actually JIT'ed, it obviously uses whatever the host machine has
 
11:45 AM
@FredOverflow color is US English and Colour is British English afaik
 
Ok, thanks.
I know, I am asking about the VM specifically.
 
They registerise the code when lowering to machine code.
 
@TonyTheTiger I know, I was asking about what Cat++ prefers.
 
oh ok
 
I wish IntelliSense worked for C++/CLI in VS 2010.
 
11:46 AM
Try VAX.
I heard good things of it.
 
VAX is $$$, isn't it?
 
But that is commercial...
 
I don't know of a free alternative.
 
@wilx I don't know about the .net VM, but if it's anything like the Java VM, it actually uses two stacks. One for activation records (parameters, local variables, return addresses), the other for evaluation and intermediate results.
 
11:48 AM
Other than the crappy vanilla IntelliSense.
 
IS is overrated.
 
@FredOverflow Yes, it's the same.
 
@RMartinhoFernandes So you can no longer say "something goes on the stack", because there are actually two distinct stacks :)
 
I don't remember last time I used VS, really.
And that was probably for the resource designer, not code, anyway.
 
@FredOverflow Well, I never say "something goes on the stack" when talking about .NET, anyway.
 
11:50 AM
By the way, don't you just love the look on students' faces when you tell them that a java.lang.Stack goes on the heap? :)
 
The "what the hell is heap" face?
3
 
This time I lose.
 
It's like Rock-Paper-Scissors with words.
 
11:51 AM
Oh, I'm good at RPS.
 
@CatPlusPlus No, because until then, they thought "stack" and "heap" would be mutually exclusive. They simply don't understand the difference between Stack objects and "the stack" used for activation records.
 
What about heaps? Do they go on the stack? :P
 
In C++, bounded heaps can be on the stack, yes :)
 
"Is an automatic std::vector on the stack, or on the heap?" "It's on both! Quantum vectors!"
 
And when vector is on heap, vector contents are on heap heap (hurray)!
 
Heap heap heap, wir ham uns alle lieb!
 
Oh, gibberish again.
 
It roughly means "we are fond of each other".
 

« first day (320 days earlier)      last day (4619 days later) »