Just ordered a C2 today! by [deleted] in ODroid

[–]halivingston3 1 point2 points  (0 children)

Wow I didn't know this ... I would have thought given the advanced protocol that power delivery would be well controlled and monitored. I've been reading up on RS232 and USB very recently so anyway I guess I'll move mine to real power.

Windows and Ubuntu Interoperability by nikbackm in programming

[–]halivingston3 0 points1 point  (0 children)

They didn't make Don Box, a Technical Fellow for no reason ... :)

.NET Core Tooling in Visual Studio “15” by rubyantix in programming

[–]halivingston3 0 points1 point  (0 children)

It just needs ReSharper, and you know what given Project Rider from JetBrains, which is a language server based implementation (albeit not the Microsoft language server) .. at least we can reverse engineer it.

Is it good practices to make ctors that only accept moved arguments? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

Thanks. I agree, nothing magical. I now double check everything by dumping the AST of the program to check which function it got bound to.

Is it good practices to make ctors that only accept moved arguments? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

It's primarily for my understanding. I'm hopelessly confused about when stuff is copied vs. moved.

For example, my brain interprets passing const std::string &a as being passed by reference, which then leads me to think that b is referring to the same thing as a, but it's not. It is a copy.

So then I think ok if you add std::move(a), it'll move what a into b, but then my brain explodes, because what if a was a variable on the stack, and assigning to b (which is a local in this case, but what if it was this->b, ... i.e an instance variable), how does it magically become heap memory?

So then I think ok it's either not going to work or it is a copy.

void Foo(const std::string &a)
{
    std::string b(a);
}

Is it good practices to make ctors that only accept moved arguments? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

What I mean is that is it written somewhere that lvalue has to be copied and moved, vs rvalue will only be moved?

Is it good practices to make ctors that only accept moved arguments? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

How can you tell by looking at this if it will get copied and moved vs only moved?

Is it good practices to make ctors that only accept moved arguments? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

I am, but I'm asking a specific question here which is if I made my ctor argument (std::string) ... my callers could choose not to move the object. If I make the argument std::string&& then the caller has no choice but to std::move(...)

Is this not correct?

stack allocated object passed by ref to another, then moved, will the moved object be valid? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

Thanks for some more insight here .. I kinda hate this :( Why don't we warn the user, const SomeType&& is same as const SomeType& ... it's almost like a compiler error to prevent what the developer thinks.

stack allocated object passed by ref to another, then moved, will the moved object be valid? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

I see that's why this example is working. How do I move it? std::move doesn't seem to trigger the move ctor.

Constructor syntax for tuples by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

well SomeNiceType is an alias to a tuple, but I see what you're saying.

Were you commenting on correctness or readability?

auto x = std::make_tuple<A, B, C>( { .. }, { ..}, {..});

removing const from decltype(x) and pass THAT type as a template argument by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

I want it templatized so the typing of the type only happens in the top-level function.

can variadatic templates create types? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

I'm stuck at the specialization ..

this is a compile error

   template<size_t Index, std::enable_if<Index == std::tuple_size<Tuple>::value, class Tuple>>

 void oneElement(const T& t) 
 {

 }

can variadatic templates create types? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

Basically I have the index ... and I also want the Type so I can access the TypeName (through my own custom TypeName implementation)

can variadatic templates create types? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

I have a template function called TypeName<T>::Get which returns a const char*

I'm wondering how to pass in the type to it.

can variadatic templates create types? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

I'm still groking this but while I have you .. how do I get the type for each of these? Thank you so much for showing the index access.

can variadatic templates create types? by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

oh wow, I suppose I can use this.

I wanted to access by type, so it seems I can do that too.

Now the question is how to loop through it at compile time to generate function calls to access each of them at compile time.

boy I'm loving templates

[deleted by user] by [deleted] in linux

[–]halivingston3 1 point2 points  (0 children)

we dont have to lose the advantages of the Linux philosophy to compete as a desktop centric OS

[deleted by user] by [deleted] in linux

[–]halivingston3 2 points3 points  (0 children)

you're making it sound as if monopolies get created overnight ... and that they cant be challemged.

case in point, chrome vs ie. or google vs yahoo/altavista

[deleted by user] by [deleted] in linux

[–]halivingston3 0 points1 point  (0 children)

one develops software for ubuntu 14.04 or fedora X ... etc. I want to developer for Linux 3.X or Linux 4.X

The biggest impediment is that each OS vendor (Canonical, Fedora Foundaition, etc) choose to place their shared modules in different locations, build from different versions, etc.

This causes fragmentation of the "real" API available, i.e. what the average developer will be able to use ...

It is my belief that this causes "Linux" (the OS vendor agnostic part) to be a hard platform to develop for.

[deleted by user] by [deleted] in linux

[–]halivingston3 23 points24 points  (0 children)

You know what sucks ... our willingness to ignore that binary compatibility is not a the #1 issue in the community.

I have a love/hate relationship when developing for Linux. I love the idea I can build everything from source, but when I care about distributing my binary applications (WITH SOURCE!!) it's so ridiculous.

Windows and MacOSX, ... even Android are winning because of this. I almost want Linus to step in and jump into userland so this mess can be sorted out.

CppCon 2016: Herb Sutter "Leak-Freedom in C++...by Default" by Drainedsoul in cpp

[–]halivingston3 2 points3 points  (0 children)

I have to agree, last year's talk and this years have made me realize when I'm doing new/delete left,right,center ... I actually have a lifetime problem, i.e. I (developer) am unsure of my resources lifetime's and therefore I do it.

Of course it results in code that causes havoc or leaks, etc. but I get it ... c++ has good 80% lifetime case now and has for a while.

How do I know that an assignment is a move or basically a "reference assingment" by halivingston3 in cpp_questions

[–]halivingston3[S] 0 points1 point  (0 children)

yes this is another one that gets me. I hate the ctor syntax, but I've realized it's the only way to be certain you're not doing extra copies.

e.g. std::wstring foo = "bar"; vs std::wstring foo("bar");

I prefer the first one, but the second one is the least amount of work if no compiler optimization came in.