Monday, July 30, 2018

Digest for comp.lang.c++@googlegroups.com - 25 updates in 8 topics

woodbrian77@gmail.com: Jul 30 12:50PM -0700

If you have been reading this forum for any length
of time you will have read things like:
 
"On-line code generators aren't a viable solution -
who wants to be dependent upon a third-party that
may disappear tomorrow?"
 
Here's a link to a cloud-based IDE
https://codetasty.com/
 
And there are a number of reasons why the C++ Middleware
Writer (an on-line code generator) is better than codetasty:
 
1. The C++ Middleware Writer is free.
2. You don't have to upload all or even most of your project.
 
Some of the "experts" here don't like the way things are going:
"I have a dream that my four little children will one day live
in a nation where they will not be judged by the color of
their skin but by the content of their character."
Pastor Martin Luther King Jr.
 
While these "experts" could get a way with it they tried to
sway people from my work. They were successful for a while,
but that's starting to crumble now.
 
 
Brian
Ebenezer Enterprises
https://github.com/Ebenezer-group/onwards
scott@slp53.sl.home (Scott Lurndal): Jul 30 08:31PM

>may disappear tomorrow?"
 
>Here's a link to a cloud-based IDE
>https://codetasty.com/
 
8.1 - CodeTasty cannot be held liable for system down time,
crashes or data loss. We cannot be held liable for any
predicated estimate of profits which a client would have
gained if CodeTasty site was functioning. Certain services
provided by CodeTasty are resold. CodeTasty holds no responsibility
for the use of our clients' accounts. Failure to comply with any
terms or conditions will result in the automatic deactivation of
the account in question. We reserve the right to remove any account,
without advance notice for any reason without restitution, as CodeTasty sees fit.
 
'nuf said.
"Öö Tiib" <ootiib@hot.ee>: Jul 30 01:55PM -0700


> While these "experts" could get a way with it they tried to
> sway people from my work. They were successful for a while,
> but that's starting to crumble now.
 
Why you compare you product with some oddball IDE that no one cares
about?

What your code generator does that people need from serialization code?
For example:
* Lot of projects need to serialize data as XML or JSON (or some other
popular format) for compatibility.
* Bigger data (like video and sound) are too expensive to serialize
without compression.
* Potentially confidential information needs to be serialized with
encryption.
Such are some of the real needs that drive the choice of protocols and
libraries. What needs your code generator fulfills? If not any of
those three then there must be something else.
 
Why they need that code, free or otherwise, by uploading their code
anywhere or nowhere? These two are not benefits if they do not need
that code.
woodbrian77@gmail.com: Jul 30 02:12PM -0700

On Monday, July 30, 2018 at 3:31:58 PM UTC-5, Scott Lurndal wrote:
> crashes or data loss. We cannot be held liable for any
> predicated estimate of profits which a client would have
> gained if CodeTasty site was functioning.
 
That's to be expected, especially for free services. If
the service isn't reliable the company behind it will suffer
for it.
 
 
Brian
http://webEbenezer.net
woodbrian77@gmail.com: Jul 30 02:51PM -0700

On Monday, July 30, 2018 at 3:55:48 PM UTC-5, Öö Tiib wrote:
> For example:
> * Lot of projects need to serialize data as XML or JSON (or some other
> popular format) for compatibility.
 
I'm open to adding support for JSON, but haven't worked on
that yet.
 
> * Bigger data (like video and sound) are too expensive to serialize
> without compression.
 
There's support for compression via code from quicklz.com.
 
> * Potentially confidential information needs to be serialized with
> encryption.
 
I don't have support for this yet, but agree it's important.
 
> Such are some of the real needs that drive the choice of protocols and
> libraries. What needs your code generator fulfills? If not any of
> those three then there must be something else.
 
It automates the creation of serialization functions.
 
The cloud-ness of it means:
1. The amount of code that you have to download/build/
maintain is minimized. So using multiple versions of
the code generator is easier than installing multiple
versions of a library/compiler. Compiler Explorer is
an example of this.
 
2. We are able to get a better idea of what to work on
than compiler vendors. Compiler vendors have to decide
whether to support things in the standard or things their
users are asking for. Maybe they make good decisions
in that area, but sometimes they don't. Because we have
an on-line tool, we have an easier time deciding what to
work on next.
 
 
Brian
Ebenezer Enterprises
http://webEbenezer.net
ram@zedat.fu-berlin.de (Stefan Ram): Jul 30 09:18PM

I'm drafting my lesson about »::std::array«.
This is the example program for »value_type«:
 
main.cpp
 
#include <array>
#include <initializer_list>
#include <iostream>
#include <ostream>
#include <string>
 
using namespace ::std::literals;
 
int main()
{ { ::std::array const a{ 4, 2, 7 };
decltype( a )::value_type v = ::std::get< 0 >( a );
::std::cout << v << '\n'; }
 
{ ::std::array const a{ "alpha"s, "gamma"s, "delta"s };
decltype( a )::value_type v = ::std::get< 0 >( a );
::std::cout << v << '\n'; }}
 
transcript
 
4
alpha
 
So, is »decltype( a )::value_type« here the most elegant /
natural / concise way to express that type or is there a
better way? (Since this is intended to show off »value_type«,
»value_type« should appear in the answer. So, »auto v = ...«
would not be helpful.)
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jul 30 11:58AM

On Thu, 2018-07-26, Paavo Helde wrote:
> On 26.07.2018 15:00, Juha Nieminen wrote:
...
 
> Agreed. For my modest indentation preferences (TABs displayed as 4
> spaces) I need to edit 2 configuration files and add some cryptic lines
> (the simpler one has also a mouse-clickable option somewhere, to be honest).
 
If you meant to write "4-position indentation", this is how my .emacs
does it:
 
(c-add-style "bsd4" '("bsd" (c-basic-offset . 4)))
(setq c-default-style "bsd4")
 
Another Emacs drawback is that the latest release still (I think)
doesn't support C++11. You have to install a newer cc-mode to
e.g. indent lamdas reasonably. I use cc-mode 5.33.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
boltar@cylonHQ.com: Jul 30 01:39PM

On 30 Jul 2018 11:58:53 GMT
 
>Another Emacs drawback is that the latest release still (I think)
>doesn't support C++11. You have to install a newer cc-mode to
>e.g. indent lamdas reasonably. I use cc-mode 5.33.
 
I just use vim and the tab key. Never had to worry about the tab key not
supporting language versions or needing to be upgraded.
Paavo Helde <myfirstname@osa.pri.ee>: Jul 30 08:28PM +0300

On 30.07.2018 14:58, Jorgen Grahn wrote:
> does it:
 
> (c-add-style "bsd4" '("bsd" (c-basic-offset . 4)))
> (setq c-default-style "bsd4")
 
In my witch recipes it reads:
 
Add into ~/.emacs :
 
(add-hook 'c++-mode-hook
'(lambda () (setq tab-width 4) (setq c-basic-offset 4)))
(setq backward-delete-char-untabify-method nil)
(add-to-list 'auto-mode-alist '("\\.h$" . c++-mode))
 
Add into ~/.gnu-emacs-custom :
 
'(tab-width 4)
 
I have to admit I have little idea what these lines do, and why
modifying two files is necessary.
Melzzzzz <Melzzzzz@zzzzz.com>: Jul 30 05:33PM


> '(tab-width 4)
 
> I have to admit I have little idea what these lines do, and why
> modifying two files is necessary.
 
That's Lisp. setq sets value to variable(symbol). add-hook and all are
functions as is setq. (function param1 param2 ...)
 
--
press any key to continue or any other to quit...
Paavo Helde <myfirstname@osa.pri.ee>: Jul 30 08:56PM +0300

On 30.07.2018 20:33, Melzzzzz wrote:
>> modifying two files is necessary.
 
> That's Lisp. setq sets value to variable(symbol). add-hook and all are
> functions as is setq. (function param1 param2 ...)
 
Yes, that's the "little" I know. What I don't know is what the add-hook
exactly does, is the symbol c++-mode-hook somehow magic or defined
somewhere else, are the symbols c++mode-hook and c++-mode somehow
related behind the scenes and how, what is
backward-delete-char-untabify-method and why it is here in my
instructions, etc.
David Brown <david.brown@hesbynett.no>: Jul 30 08:56PM +0200

On 26/07/18 21:48, Ian Collins wrote:
>> quick
>> as indentation then perhaps development isn't the right job for them.
 
> It's not laziness, it's an editor changing what I write!
 
It is the editor doing the simple, automated stuff so that the
programmer can concentrate on more important things.
 
Automatic indentation can be a pain if an editor tries to be too smart
about it while failing to allow the customisation you want. But if it
is either fairly simple, or if it can be set to match your own style,
then it is a very handy benefit of the editor.
Melzzzzz <Melzzzzz@zzzzz.com>: Jul 30 08:45PM

> related behind the scenes and how, what is
> backward-delete-char-untabify-method and why it is here in my
> instructions, etc.
 
Well, if you don't have that documented you can only guess...
 
--
press any key to continue or any other to quit...
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jul 30 03:48AM +0200

On 29.07.2018 16:42, Mr Flibble wrote:
>> <windows.h>. The solution: to define `WIN32_LEAN_AND_MEAN`.
 
>> Also, I discovered, `_UNICODE` (not just `UNICODE`) needs to be
>> defined to make the wxWidgets environment detection scheme work.
 
After posting that I discovered that there's also a redefinition of M_PI
it isn't already defined. Which with MSVC then can trigger a warning
about "already defined". Which is not acceptable when one compiles with
warnings as errors.
 
So my current wrapping of the include of the wxWidgets main header now
looks like this:
 
 
------------------------------------------------------------------------
// The following two macros defined by <wrapped-windows/windows-h.hpp>:
// WIN32_LEAN_AND_MEAN avoids dragging in buggy part of <windows.h>
// _UNICODE makes wxWidgets macro scheme work.
#include <wx/msw/winver.h> // Windows version macros.
#include <wrapped-windows/windows-h.hpp> //
#include <stdlib/fix/math_constants_availability.hpp> // M_PI
#include <wx/wx.h> // Includes <windows.h> :(
------------------------------------------------------------------------
 
 
[snipalot]
 
Mr. Flibble, please quote only relevant stuff, but do quote that.
 
 
> Alf, why do you think anyone would be interested in this old way of
> doing things
 
Because AFAIK there aren't any viable modern alternatives except maybe
your library. Which I haven't tried, sorry. Well, and maybe the
Ultimate++ which likewise I haven't tried, but for different reasons.
 
Wikipedia's list: <url:
https://en.wikipedia.org/wiki/List_of_platform-independent_GUI_libraries>
 
 
> and the post in general?
 
GUI is one of the most often asked questions about C++. How does one do it?
 
 
> These days people use Qt (or soon my lib, neoGFX).
 
I don't like Qt. For one thing, its preprocessing, the `moc` compiler.
For another, the idea of dynamic type checking. Third, I remember years
ago when I tried to install it, the installation dialog failed to handle
the backspace key, typical for originally Unix-land code incompetently
ported to Windows (I don't recall exactly if it also had problems with
spaces in paths, but probably, it's in that general territory). Fourth,
their old white papers, pretending to have some have academic reasons
for the ungood design. That's also an incompetence indicator, defending
the bad decisions with academic nonsense that /looks/ impressive. Fifth,
that it's 1990's tech.
 
wxWidgets is also 1990's, but it's not Qt. :)
 
Do you have a tree view in neoGFX?
 
 
Cheers!,
 
- Alf
Paavo Helde <myfirstname@osa.pri.ee>: Jul 30 10:49AM +0300

On 29.07.2018 15:48, Alf P. Steinbach wrote:
> with FLTK).
 
> So I switched to wxWidgets as portable GUI framework, because Qt has
> that decidedly uncute preprocessing, a custom language dialect.
 
I have tried to stay clear from GUI programming as much as possible
though there is an old legacy MFC app which I have been supporting and
occasionally extending for the last 15 years. But recently I was tasked
to rewrite a small GUI tool on Windows because the existing tool only
worked on a 32-bit Mac, a dead platform (and they were afraid the single
computer we had somewhere might die soon as well).
 
I think they expected me to use C# or Java or a Powershell script
because nobody makes GUI programs in C++ any more, right? But as a C++
guy and believing in portability I chose wxWidgets instead, partially
because the wxWidgets libraries happened to be already there for
satisfying some third-party dependencies.
 
Instead of trying to read through all the docus and build the app from
the scratch I just took some of their examples and massaged it until it
did the needed thing. So I did not encounter any problems with main(),
_UNICODE or <windows.h>, these were all resolved or avoided in the example.
 
To be honest, I expected something more fancy. Instead I basically found
the same old MFC, just cleaned up and regularized a bit. WxWidgets
relies heavily on macros as well (BEGIN_EVENT_TABLE, EVT_BUTTON, etc).
Also, instead of main() I seem to have something like IMPLEMENT_APP(MyApp).
 
So, the thing worked, but the experience was not so great. I hope to
avoid GUI programs also in the future, but if this happens to be not
possible, I will probably try out some other framework, maybe Flibble's
neoGFX?
Christian Gollwitzer <auriocus@gmx.de>: Jul 30 10:02AM +0200

Am 30.07.18 um 03:48 schrieb Alf P. Steinbach:
 
> I don't like Qt. For one thing, its preprocessing, the `moc` compiler.
> [...]
 
> wxWidgets is also 1990's, but it's not Qt. :)
 
wxWidgets uses a very obsolete technique to handle event bindings. These
static event tables are quite inflexible and cumbersome once they become
larger.
 
You could have a look at "gtkmm", which uses libsigc++ for event
handling. It is based on C++ template features and achieves the same
flexibility as in QT with the moc. The moc was necessary back then when
they designed Qt, with today's C++ it is not longer necessary. They just
don't want to switch for compatibility reasons.
 
Christian
woodbrian77@gmail.com: Jul 30 08:47AM -0700

On Sunday, July 29, 2018 at 9:42:17 AM UTC-5, Mr Flibble wrote:
 
 
> Alf, why do you think anyone would be interested in this old way of doing
> things and the post in general?
 
Not everyone is able to use the latest tech.
I'm wondering if 2011 C++ is the new C.
 
 
 
Brian
Ebenezer Enterprises - "Do not boast about tomorrow, for you do
not know what a day may bring." Proverbs 27:1
 
http://webEbenezer.net
Melzzzzz <Melzzzzz@zzzzz.com>: Jul 30 05:27PM

> with FLTK).
 
> So I switched to wxWidgets as portable GUI framework, because Qt has
> that decidedly uncute preprocessing, a custom language dialect.
 
You don't have to use qt's signal/slot at all.
Some 20 years ago I just overrode event() virtual function
of application and used my own event handling.
Also you can override per object.
 
> EVT_MENU( wxID_EXIT, Main_window::on_cmd_exit )
> EVT_MENU( wxID_ABOUT, Main_window::on_cmd_about )
> wxEND_EVENT_TABLE()
 
MFC anyone? ;)
 
--
press any key to continue or any other to quit...
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jul 30 10:52AM

On Mon, 2018-07-16, Andrew Goh wrote:
> c++ is quite as 'native' to me, i'd guess most 'java programmers'
> (and so do other similar managed languages) are somewhat spoilt by
> garbage collection.
 
Then you should use the things discussed above with care. A lot of
C++ code doesn't need ownership-by-pointer at all; things are often
owned by being on the stack, or owned by some other object, or owned
by a std::vector or similar.
 
Smart pointers are useful, but don't use them to pretend it's
Java or Python. Strict and rigid ownership is a good thing,
in the scenarios where it works.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
woodbrian77@gmail.com: Jul 30 08:10AM -0700

On Monday, July 30, 2018 at 5:52:21 AM UTC-5, Jorgen Grahn wrote:
> by a std::vector or similar.
 
> Smart pointers are useful, but don't use them to pretend it's
> Java or Python.
 
The developer of unique_ptr describes a good alternative
to unique_ptr here:
https://stackoverflow.com/questions/38780596/how-to-handle-constructors-that-must-acquire-multiple-resources-in-an-exception#38780597
 
I sometimes use unique_ptr, but not that often.
 
 
Brian
Ebenezer Enterprises
http://webEbenezer.net
https://github.com/Ebenezer-group/onwards
Jeff-Relf.Me @.: Jul 30 06:15AM -0700

Jorgen Grahn <grahn+nntp@snipabacken.se>: Jul 30 10:07AM

On Tue, 2018-07-17, Adam Wysocki wrote:
 
> What is your preference towards indenting contents of namespaces?
 
> Although I find indented blocks easier to read (easier to see that this is
> in fact part of the namespace),
 
Me too. "Don't indent namespaces" has been the rule at work (2/2
places which used modern C++) but I can't get used to it. It's a
block of related stuff; I want the indentation to reflect that.
 
For example, I can't get used to seeing:
 
};
}
 
I remember not indenting them when I first started using them, in 2002
or so. My books indented namespaces; my editor defaulted to indenting
namespaces ... it seemed like a dumb idea to, as a newbie, start by
breaking existing conventions.
 
I don't see any negative effects of indenting. For me, it mostly
affects header files and anonumous namespaces, and I never nest them
very deeply.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
boltar@cylonHQ.com: Jul 30 11:24AM

On 30 Jul 2018 10:07:40 GMT
 
>Me too. "Don't indent namespaces" has been the rule at work (2/2
>places which used modern C++) but I can't get used to it. It's a
>block of related stuff; I want the indentation to reflect that.
 
The problem is that namespaces usually extend over 1 or more files so if you
indent everything in a namespace you often indent almost every line in a file
which IMO is rather pointless and leads to reduced readability.
Paavo Helde <myfirstname@osa.pri.ee>: Jul 30 10:02AM +0300

On 30.07.2018 0:30, jacobnavia wrote:
 
> This is another sign of the triumph of form over functionality. Of looks
> over substance, an example of our time.
 
Beauty requires sacrifice, eh?
 
Nothing new here, women have used neck rings, lip plates and foot
binding for ages. Not to speak about peacock tails. Not to speak about
all those tall church towers which used to catch the lightning so well.
Manfred <noname@add.invalid>: Jul 30 01:22PM +0200

On 7/29/2018 11:30 PM, jacobnavia wrote:
> This is another sign of the triumph of form over functionality. Of looks
> over substance, an example of our time.
 
But back in time Aristotle considered /form/ and /matter/ as the
constituents of /substance/, i.e. the indivisible union of form and matter.
This because the union of the form of and object and its matter are the
defining factors of the object itself.
 
Ironically, this is not just theoretical old philosophy, it sounds like
something that nowadays' marketing guys know very very well ;)
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: