Sunday, May 3, 2020

Digest for comp.lang.c++@googlegroups.com - 7 updates in 2 topics

Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: May 03 02:35AM +0100

Hi,
 
Doing my bit to fight climate change:
 
#pragma once
 
#include <neogfx/neogfx.hpp>
#include <chrono>
#include <neogfx/core/i_event.hpp>
 
namespace neogfx
{
class i_power
{
public:
declare_event(activity_registered)
declare_event(green_mode_enabled)
declare_event(green_mode_disabled)
declare_event(green_mode_entered)
declare_event(green_mode_left)
declare_event(turbo_mode_enabled)
declare_event(turbo_mode_disabled)
declare_event(turbo_mode_entered)
declare_event(turbo_mode_left)
public:
virtual ~i_power() = default;
public:
virtual void register_activity() = 0;
virtual std::chrono::seconds activity_timeout() const = 0;
virtual void set_activity_timeout(std::chrono::seconds aTimeout) = 0;
virtual bool is_green_mode_enabled() const = 0;
virtual void enable_green_mode() = 0;
virtual void disable_green_mode() = 0;
public:
bool is_turbo_mode_enabled() const
{
return !is_green_mode_enabled();
}
void enable_turbo_mode()
{
disable_green_mode();
}
void disable_turbo_mode()
{
enable_green_mode();
}
};
}
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: May 03 01:41PM +0100

On 03/05/2020 09:06, Dave Henderson wrote:
> Did your brain fell out?
 
Did yours?
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 03 01:57PM -0700

On 5/2/2020 6:35 PM, Mr Flibble wrote:
>     };
> }
 
> /Flibble
 
A timeout that triggers a pause? Say 30 seconds of no activity detected,
pause everything. requestAnimationFrame seems to do this automatically
in browsers. If I go to a different tab, animations are paused.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: May 03 11:34PM +0100

On 03/05/2020 21:57, Chris M. Thomasson wrote:
>> }
 
>> /Flibble
 
> A timeout that triggers a pause? Say 30 seconds of no activity detected, pause everything. requestAnimationFrame seems to do this automatically in browsers. If I go to a different tab, animations are paused.
 
More or less. You get it shame that fucktard "Dave Henderson" didn't.
 
Final version of the abstraction can be found here: https://github.com/i42output/neoGFX/blob/master/include/neogfx/core/i_power.hpp
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
Manfred <invalid@add.invalid>: May 03 03:41PM +0200

On 5/1/20 7:43 PM, Paavo Helde wrote:
> compatible with extensions (abstract base classes, std::function
> callbacks, etc). C++03 is actually pretty good for building such
> infrastructure.
 
Isn't std::function one of the additions of C++11?
Manfred <invalid@add.invalid>: May 03 04:04PM +0200

On 5/1/20 6:45 PM, red floyd wrote:
> throw C++03 at a C++11 compiler and it will build, but as this is a one
> time only deal, we want to do things as right as possible the first
> time.
 
As other have said, the transition from C++03 to C++11 may not be that
hard, however you may want to give a look at
https://en.cppreference.com/w/cpp/11
 
The point is that C++11 was "the most important update since C++98" (the
next one being probably C++20), and this is evident from the list of new
core language features.
 
Many of these features do have impact at the design level, so the
decision about using them or not is not only a matter of
maintainability, but it may also have influence on how you want to shape
your design - I am thinking of things like lambdas, std::function, move
semantics, variadic templates, constexpr, (also static_assert is pretty
handy) ...
In other words, upgrading incrementally from C++03 to C++11 may lead to
some loss in design homogeneity.
On the other hand, it is also true that many C++03 implementations
already included a number of C++11 features that were published in
advance as TR's.
 
Of course all of this depends on your needs, it is very well possible
that none of the features above really matters for your specific
project, keeping things simple is still the golden rule of good design.
 
My 2c
 
Ian Collins <ian-news@hotmail.com>: May 04 08:09AM +1200

On 04/05/2020 01:41, Manfred wrote:
>> callbacks, etc). C++03 is actually pretty good for building such
>> infrastructure.
 
> Isn't std::function one of the additions of C++11?
 
Yes it is, C++03 code would have to use boost::function.
 
--
Ian.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: