« first day (877 days earlier)      last day (1966 days later) » 

6:42 AM
@ptr_user7813604 adventofcode.com
 
 
1 hour later…
7:53 AM
@ma1169 Hi
Did anyone knows about SDL_Window?
I have checked
SDL2image-2.0.4
SDL2-2.0.9 but didn't solving error
 
 
6 hours later…
1:54 PM
@ptr_user7813604 we legally cannot answer this question
@ptr_user7813604 this is felonious activity, you have been warned
 
@ptr_user7813604 even if it's family you can go to jail for that
 
OK, I were just kidding, I'm learning about device driver
 
nwp
Just trip over his power cable. Much easier.
 
Great
He always opens my files, so I angry with that
 
nwp
1:59 PM
Your files on your computer? Or a shared computer?
 
my computer, lol
 
nwp
Have you considered requiring a login password?
 
I never use a password for my laptop, but now I should consider it
 
nwp
Solving social problems with technology usually backfires. Try "Dude, don't open my files" followed by "Mom, he keeps opening my files" and only escalate to a password after the previous 2 things failed.
Fortunately for you OSs are designed with multiple users in mind, so you can easily make multiple user accounts that don't allow reading each other's files.
 
I always try to solve things myself, but you're right.
I like learning OS
I'm reading about it, and I usually found some description imprecise/unclear
 
nwp
2:08 PM
What is it here? Drivers, user accounts or something else?
 
Operating System Concepts
My english is not very well because it's one thing I tried to solved myself, u know.
But I think the philosophy is the same as programming, as it works for some limited realm/input, then it's correct.
 
nwp
You could type "operating systems" into amazon and maybe find something you like and get it for christmas. Books are decent at teaching operating system principles.
You can also find uni classes on youtube or something, but those tend to be rather long and boring.
 
yeah but I rarely buy book, after i have a laptop and Internet
Is it really useful to read book to learn operating system?
I always believe that there are some people just go directly to read Linux kernel or so, and the result is the same
but it's just my guessing
 
nwp
It is. But it depends on how much you want it. If you want it so much that you are willing to read a whole book while also looking stuff up on wikipedia then yes, it's a pretty good way. But I can totally understand if you don't want it that much.
 
those books always has so many pages
but I always read, I read anything
the most difficult one so far I read
is myself
 
nwp
2:21 PM
The linux kernel is huge and not intended for teaching. Would not recommend for learning operating systems.
 
Then it's no luck for me, I always think the purpose learning programming is be practical, to get my hands dirty, write something, ask possibly-be-closed questions
And have fun talking with people here
 
nwp
You can go to osdev and read stuff from there. They also have tutorials for writing a basic operating system. It's quite fun, although the use of that knowledge is rather questionable.
 
Thanks for the link, I will consider it
Wow, I'm always thinking about writing a basic one!
Thank you so much!
 
nwp
No problem. Maybe you can actually make something cool :D
 
lol, I will try to make it work first, but yeah, I should make something cool, not just reading the boring book.
 
 
2 hours later…
4:36 PM
what does template<typename...> using void_t = void; do? How can this code be used?
 
see the example code at cppreference en.cppreference.com/w/cpp/types/void_t
 
@milleniumbug I'm trying to understand the following code:
template<typename...>
using void_t = void;
template<typename T>
void_t<typename T::foo> f();
f<int>(); // error, int does not have a nested type foo
why is there a parameter pack in the first line? and how does the compiler interpret the fourth line?
 
there's a parameter pack because you should be able to put in as many types as you want there
struct A { typedef int foo; }; /* ... */ f<A>(); will just call the function
and the function will have a void return type
 
which function does it call? A::f(), provided it exists?
 
4:51 PM
no, f
template<typename T> // template parameters
void_t<typename T::foo> // return type
f(); // function name and parameter list
 
so, if instantiated with a class that has the appropriate nested class, it should be read as T::foo f() {...}?
 
no
it's void f()
 
ok, and where does the template parameter come in?
 
nowhere in the type of the function
 
it's just an useless example, then?
 
4:56 PM
it just makes invalid substitution
f<int>(); // error, int does not have a nested type foo is the whole point
 
I wanted to know what a valid example looked like
 
it is a valid example
the whole point is to make it not compile
void_t<typename T::foo> f(); // gets substituted as
void_t<int::foo> f(); // rejected
 
ok, and without foo?
 
struct A { typedef int foo; };
void_t<typename T::foo> f(); // gets substituted as
void_t<A::foo> f(); // gets substituted as
void f(); // ok
also, again
note the example at the bottom
in particular, the is_iterable thing
the specialization of is_iterable that won't compile will be rejected thanks to SFINAE
therefore we can check which types are iterable and which are not
 
hmm, a little bit too advanced for me at this point of time...
 
5:09 PM
don't worry about it, C++ at this level tends to use side effects in its features like this a lot.
it's literally piling a hack on top of another hack
so don't feel bad about it, if it feels counter-intuitive
 
thanks, feeling better about it already ;)
template<class T>
struct A;
template<class T>
using B = typename A<T>::U; // type-id is A<T>::U
template<class T>
struct A { typedef B<T> U; };
B<short> b; // error: B<short> uses its own type via A<short>::U
B<short> b; would be equivalent to A<short>::B<short>, right?
kinda looks recursive to me
 
5:25 PM
template <typename T>
constexpr std::string_view type_name() {
	constexpr std::size_t offset = 55;
	std::string_view p = __PRETTY_FUNCTION__;
	return std::string_view(p.data() + offset, p.find(';', offset) - offset);
}

template<typename T>
using lambda = decltype([] { std::cout << type_name<T>() << std::endl; });
how can I make it work?
so I can write lambda<int>()?
 
using lambda = ...; is a type alias
@MiroslavCetojevic which is why it fails
 
@milleniumbug meaning what?
 
so if you expect that lambda<int>() will print anything to screen, your assumption will fail
(even if lambdas were available in decltype(...))
more specifically, what is that even supposed to work
 
ah, crap, it looks like that example was meant for C++20
you can see it before the final code example: en.cppreference.com/w/cpp/language/type_alias
I think this would be a neat feature
 
 
2 hours later…
7:42 PM
template<auto n> struct B { /* ... */ };
B<5> b1;   // OK: non-type template parameter type is int
B<'a'> b2; // OK: non-type template parameter type is char
B<2.5> b3; // error: non-type template parameter type cannot be double
why can't double be used as a template parameter in this example?
is it because n needs to be an integral type?
 
8:02 PM
template<auto...> struct C {};
C<'C', 0, 2L, nullptr> x; // OK
is there even a way to access the arguments deduced for auto...?
 
nwp
It's much easier if you give them a name.
 
yeah, just wondered if you could do without, but in hindsight that sounds a bit silly
 
nwp
I mean you can, but it's just silly.
 
please tell me ^^
 
nwp
8:18 PM
template <auto f, auto...args>
constexpr auto first(C<f, args...>) {
    return f;
}
std::cout << "First argument: " << first(x) << '\n';
That looks like it might compile.
 
but you named the parameter pack...
17 mins ago, by Miroslav Cetojevic
template<auto...> struct C {};
C<'C', 0, 2L, nullptr> x; // OK
 
nwp
For the helper first yes. C still doesn't have a name for the parameters.
 
so I can't actually access the arguments with just the pack notation...
a name is still needed
 
nwp
Can you say what you actually want to achieve? It's like saying "I have void f(int);. How do I access the int without giving it a name?". That's just a silly thing to want.
 
the code I wrote was taken from this page
it was obviously to showcase how auto... works
I just wondered if you could do something more interesting than just pass arguments without ever using them
 
nwp
8:25 PM
You can do stuff like parsing regex at compile-time. But yes, that requires to name your parameters.
 
what's the use of template<typename T = void> struct A {};?
isn't that the same as just struct A {};?
 
nwp
No. The first is a template, the second is not.
They are as much the same as void f(int i = 0); and void f(); are the same.
 
9:23 PM
in regards to templates as template parameters: why is it the syntax template<typename K, typename V, template<typename> typename T = someType> and not template<typename K, typename V, template<typename T = someType>>?
 
nwp
9:41 PM
The second doesn't really make sense. The T must be deduced. Putting a default type there might even compile, but it can never be picked.
 
9:54 PM
yeah, you are right, it really doesn't make sense...
I wonder why not just do something like template<typename A, typename B<C>>, though...
simpler syntax than what we have now
 
nwp
How do you differentiate between C being a type or a value?
Although in fairness not differentiating those would actually be an advantage.
 
I suppose you could add the typename keyword before C
and thinking on your last comment, couldn't the template system benefit from instantiating regardless of whether the template arguments were types or values?
and in the latter case, the value could've been used to assign members/variables inside the template class/function and instantiate with the type of said value
but then again, perhaps this was already discussed in the committee...
 
nwp
Writing code for a C when you don't know if it's a type or a value seems tricky.
 
10:10 PM
there would've to be restraints/rules, obviously...
I'm just musing anyway
 

« first day (877 days earlier)      last day (1966 days later) »