Language:
switch to room list switch to menu My folders
Go to page: First ... 116 117 118 119 [120] 121 122 123 124 125
[#] Sat Nov 19 2016 07:12:37 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


(And, yeah, it can handle http or https... technically, I think it could transfer across serial ports or any other transport if you built the low end for it).

[#] Mon Nov 21 2016 14:00:18 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Apparently Java can't get this right, either. Apache httpcore is a mind-bogglingly large API.

[#] Mon Nov 21 2016 18:11:27 EST from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

waitwaitwhat? All this getting done in headers? Is C++ truly this brain damaged or am I missing something?

[#] Tue Nov 22 2016 13:24:56 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Pretty much, yeah. Doing everything with templates and type-safety means doing it in headers. It's a suboptimal state of affairs.

[#] Tue Nov 29 2016 12:33:36 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Well, one could turn it into a proper .lib or .so library if desired, but why bother when you can distribute a bunch of headers and not have to worry about how the shared object was compiled, or with what will it link?

[#] Tue Nov 29 2016 17:27:32 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


compile time. an object-oriented http library, which is reasonably full-featured and modular, is going to be highly layered and rather large.


you may be building something lean and mean that's just good enough for your needs, but not really general-purpose.

[#] Thu Dec 01 2016 08:57:50 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Yeah, header libraries can increase compile time when you do things like include base headers that include tons of other header files, instead of just pulling the header files you need in the library.

If you build the header library carefully, you can reduce the compile to just what is needed, which often doesn't require that much time to compile.

And if your compile times *still* grow to something kind of nuts, you can probably do something clever with your own implementation files to reduce compile times, by moving the often-changing stuff to places that don't pull in header libraries.

Eh, I probably just haven't had a big issue with compile times. My current project requires about 7 minutes to fully compile everything (both 32 and 64 bits, so I have to compile everything twice).

[#] Thu Dec 01 2016 09:36:19 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


On an unrelated note, I saw something today that does a great job of explaining why 'const' is a good thing, and not to be trifled with.

void a(std::string var) {
char* tok = strtok(const_cast<char*>(var.c_str(), " ");
while (tok) {
fn(tok);
tok = strtok(0, " ");
}
}

int main() {
std::string var = "moo bark quack";
a(var);
return 0;
}

(aside from not having created 'fn()'), this code is evil.

You figure, "Oh, no big deal... a() uses a copy of the std::string, since this isn't passed by reference, so the const_cast won't lead to any problems."

Except you didn't know that some vendors won't actually copy the string used by the std::string class until some operation takes place that requires it... and .c_str() isn't that operator, since it's protected by const.

So, your function now leads to side effects that burns your coworkers.

[#] Thu Dec 01 2016 09:37:16 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Ugh... forgot a paren in that code... trying to write it on-the-fly.

[#] Thu Dec 01 2016 09:45:23 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


const's virus-like behavior is quite challenging in C++. Java probably strikes a better balance by simply accepting that some things are out of our control at compile time.

[#] Thu Dec 01 2016 11:39:46 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Maybe, although in this case, it did its job.

My eye zeroed in on the const_cast immediately, and it highlighted the problem.
I was able to deduce the issue and solve the problem in very short time because I could see something odd was going on (one almost never needs to const_cast... it's just one of those things that screams at you when you see it).

It's like type safety... I know tons of people hate it, because it seems to prevent people from getting code written, but that early detection helps avoid many terrible issues that come up when you accidentally mix types. Seeing things like reinterpret_cast or static_cast helps draw your eye on possible problems when you're trying to figure out why something went off.

[#] Thu Dec 01 2016 14:24:01 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


In Java, the type system is just less expressive. Primitive types can be "const"; actually the word for this is "final" in Java. A reference to an object is a primitive type. If the reference is "final", the reference can't be modified but the object it refers to *can*, so long as there is at least one non-final field in that object. Unlike C++ there's no notion of a struct or class that contains non-const fields but a particular instance of or reference to the struct could be declared const. So you can't express quite such binding constraints in the type system.... but you spend less time fighting with the compiler because of somebody else's lack of foresight.

[#] Thu Dec 01 2016 14:39:42 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Java wasn't an option for our needs, though.

I use it when dealing with ESXi and certain other situations, but not for some of this work we're doing.

[#] Wed Jan 18 2017 13:38:20 EST from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

const's virus-like behavior is quite challenging in C++.

CONST CONSIDERED HARMFUL

[#] Wed Jan 18 2017 14:56:29 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Oh gosh. Can of worms. You sort of have to use const everywhere you safely can, because somebody else's code might force you into it.

[#] Wed Jan 18 2017 14:57:23 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


"CONSIDERED HARMFUL" CONSIDERED HARMFUL.

[#] Wed Jan 18 2017 17:33:30 EST from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Yeesh. I'm going to write a "deconstifier" shim that allows you to interface with other people's code, casting between const and non-const without throwing a compiler warning. And I'm going to reserve the domain "deconstifier.io" because when you have an .io domain people automatically assume that you are an inarguably brilliant developer.

""CONSIDERED HARMFUL" CONSIDERED HARMFUL" CONSIDERED HARMFUL

[#] Thu Jan 19 2017 15:05:56 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Er... in C++, you can use 'const_cast<>()'.

But, I find const helpful. It hasn't been a problem for me.

[#] Tue Jan 24 2017 13:59:14 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


mysql, you surprise me.

In 2012, someone complained that their documentation doesn't state that concatenating a string past the max_allowed_packet will result in a 'null' for the string, and how heinous that is, etc.

So they documented this fact. But not in the part of the documentation where you'd look at the concat or concat_ws string manipulation functions. No, that would be a wholly logical, reasonable, intuitive place to look for such a thing. Instead, they documented it at the end of the table of string functions, where everyone would look for such a thing.

The *only* reason I found this was after looking at the bug report. I don't normally make a habit of looking tediously over every shred of documentation when I need to research a problem, because, I dunno, I have other things I need to accomplish in a day or something.

I dunno... I guess I could complain and be the first person since 2012 to point out the ridiculous nature of their solution and be known as 'That Guy' or something. On the other hand, I could just tuck it away as My Little Secret and whip it out someday when the right set of circumstances come about where such information is useful.

In the meantime, fucking hell.

[#] Wed Jan 25 2017 10:14:36 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


You can't have a BLOB past max_allowed_packet either.


lame, but I guess not enough people are yelling.

Go to page: First ... 116 117 118 119 [120] 121 122 123 124 125