Saturday, February 9, 2019

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

Jivanmukta <jivanmukkta@poczta.onet.pl>: Feb 09 04:08PM +0100

I have little experience in C++. I am thinking about programming simple
PHP obfuscator in C++ for Linux and Windows. I would like to have same
source code for Linux and Windows (for easier maintenance of source
code). Is it good idea to have one project and to use preprocessor for
Linux/Windows differences? Which version of C++ I should use? Which C++
compilers? Windows version of my program should use GUI and compile to
32/64 bit binary, not .NET. Linux version should be command line tool.
Jivanmukta <jivanmukkta@poczta.onet.pl>: Feb 09 04:54PM +0100

Thank you for your answer.
Paavo Helde <myfirstname@osa.pri.ee>: Feb 09 05:59PM +0200

On 9.02.2019 17:08, Jivanmukta wrote:
 
 
> Is it good idea to have one project and to use preprocessor for
> Linux/Windows differences?
 
No, peppering the code with #ifdef __linux__ is not a good way to go if
that's what you have in mind. Instead declare needed classes or
functions in a single header file whose implementation is provided in
separate implementation files for different platforms.
 
> Which version of C++ I should use?
 
C++11. Additions in later revisions are more cosmetic and not yet
universally supported, so may cause portability issues.
 
> Which C++ compilers?
 
You can use different compilers on each platform, e.g. gcc or clang in
Linux, MSVC on Windows. For debugging nothing beats MS Visual studio,
especially for beginners.
 
> Windows version of my program should use GUI and compile to
> 32/64 bit binary, not .NET. Linux version should be command line tool.
 
This is 3 projects, not one: one common base library providing the
actual functionality, one command-line executable and one GUI
executable. With such separation it might even be you do not need to
care about platform differences in the code at all, you just do not
build some project on some platform.
 
General portability notes: use UTF-8 for all strings internally, convert
to UTF-16 at the application border in Windows, i.e. use only wide
versions of the Windows API functions, e.g. MessageBoxW().
Jivanmukta <jivanmukkta@poczta.onet.pl>: Feb 09 05:22PM +0100

Thank you for your answer.
David Brown <david.brown@hesbynett.no>: Feb 09 07:14PM +0100

On 09/02/2019 16:08, Jivanmukta wrote:
> Linux/Windows differences? Which version of C++ I should use? Which C++
> compilers? Windows version of my program should use GUI and compile to
> 32/64 bit binary, not .NET. Linux version should be command line tool.
 
Presumably you are familiar with PHP programming? Use PHP, not C++ - it
will be much easier. C++ is an excellent language for many purposes,
but it is a good deal more difficult for a text manipulation task like this.
Jivanmukta <jivanmukkta@poczta.onet.pl>: Feb 09 07:42PM +0100

W dniu 09.02.2019 o 19:14, David Brown pisze:
> will be much easier.  C++ is an excellent language for many purposes,
> but it is a good deal more difficult for a text manipulation task like
> this.
 
But I want to have Windows .exe and Linux executable binary file.
I think I decide for Python because I can use it for web-developement
which is my main activity.
Thanks for your answer.
David Brown <david.brown@hesbynett.no>: Feb 09 09:35PM +0100

On 09/02/2019 19:42, Jivanmukta wrote:
>> purposes, but it is a good deal more difficult for a text manipulation
>> task like this.
 
> But I want to have Windows .exe and Linux executable binary file.
 
Why? You can make an executable program in PHP, as long as PHP is
installed on the system (just like with Python). People often think PHP
only works in a web server, but that is not true.
 
However, Python is absolutely fine for the purpose, and probably better
than PHP - I only only suggested PHP because I thought perhaps you were
already familiar with the language.
 
 
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 08 11:29PM

On 08/02/2019 17:40, Mr Flibble wrote:
> language schema!
 
> Available on GitHub: https://github.com/i42output/neos
 
> Coming soon!
 
So WASM is a bit shite as it appears to lack a jump instruction. I will no
longer be using WASM in neos.
 
/Flibble
 
--
"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," Bryne 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>: Feb 09 12:44AM

On 08/02/2019 23:29, Mr Flibble wrote:
 
>> Coming soon!
 
> So WASM is a bit shite as it appears to lack a jump instruction. I will no
> longer be using WASM in neos.
 
Now that I have rescinded the use of WASM in neos (due to its lack of a
jump instruction) here is the register map for the neos bytecode virtual
machine:
 
https://github.com/i42output/neos/blob/master/src/bytecode/registers.hpp
 
/Flibble
 
--
"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," Bryne 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."
Cholo Lennon <chololennon@hotmail.com>: Feb 08 10:47PM -0300

On 2/8/19 8:29 PM, Mr Flibble wrote:
 
>> Coming soon!
 
> So WASM is a bit shite as it appears to lack a jump instruction. I will
> no longer be using WASM in neos.
 
I am using C++ with clang 4/7 (that outputs wasm) to write smart
contracts for EOS blockchain. From the C++ point of view it is all
transparent. Of course, there are some limitations due to the
deterministic nature of a blockachain (i.e. I can't use a timer or open
files), but beyond that everything is Ok with wasm and C++ (at least in
my experience). I know that it is not the same a "jump" as a "goto", but
the C/C++ goto statement is supported (emulated with the "block" opcode)
 
Regards
 
--
Cholo Lennon
Bs.As.
ARG
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 09 04:18AM

On 09/02/2019 01:47, Cholo Lennon wrote:
> everything is Ok with wasm and C++ (at least in my experience). I know
> that it is not the same a "jump" as a "goto", but the C/C++ goto statement
> is supported (emulated with the "block" opcode)
 
Emulated = bad.
 
The decision has already been made: I will be using a bytecode of my own
design.
 
/Flibble
 
--
"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," Bryne 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."
Cholo Lennon <chololennon@hotmail.com>: Feb 09 03:03PM -0300

On 2/9/19 1:18 AM, Mr Flibble wrote:
>> "goto", but the C/C++ goto statement is supported (emulated with the
>> "block" opcode)
 
> Emulated = bad.
 
Well, maybe wasm is not so bad if C/C++/rust can be compiled to it.
 
 
> The decision has already been made: I will be using a bytecode of my own
> design.
 
Regards
 
--
Cholo Lennon
Bs.As.
ARG
Cholo Lennon <chololennon@hotmail.com>: Feb 09 04:22PM -0300

On 2/9/19 3:03 PM, Cholo Lennon wrote:
>>> "block" opcode)
 
>> Emulated = bad.
 
> Well, maybe wasm is not so bad if C/C++/rust can be compiled to it.
 
I've just received this new paper, it's very interesting:
 
Mind the Gap: Analyzing the Performance of WebAssembly vs. Native Code
https://arxiv.org/abs/1901.09056
 
--
Cholo Lennon
Bs.As.
ARG
Horizon68 <horizon@horizon.com>: Feb 09 09:57AM -0800

Hello...
 
 
About FlushProcessWriteBuffers() and IPIs and C++..
 
It seems that the implementation of the sys_membarrier on Linux 4.3 is
too slow. Starting with kernel 4.14, there is a new flag
MEMBARRIER_CMD_PRIVATE_EXPEDITED that enables much faster implementation
of the syscall using IPI.
 
See
https://lttng.org/blog/2018/01/15/membarrier-system-call-performance-and-userspace-rcu/
 
for some details.
 
And read the following about Userspace RCU, it is also using IPIs:
 
membarrier system call performance and the future of Userspace RCU on Linux
 
Read more here:
 
https://lttng.org/blog/2018/01/15/membarrier-system-call-performance-and-userspace-rcu/
 
 
Cache-coherency protocols do not use IPIs, and as a user-space level
developer you do not care about IPIs at all. One is most interested in
the cost of cache-coherency itself. However, Win32 API provides a
function that issues IPIs to all processors (in the affinity mask of the
current process) FlushProcessWriteBuffers(). You can use it to
investigate the cost of IPIs.
 
When i do simple synthetic test on a dual core machine I've obtained
following numbers.
 
420 cycles is the minimum cost of the FlushProcessWriteBuffers()
function on issuing core.
 
1600 cycles is mean cost of the FlushProcessWriteBuffers() function on
issuing core.
 
1300 cycles is mean cost of the FlushProcessWriteBuffers() function on
remote core.
 
Note that, as far as I understand, the function issues IPI to remote
core, then remote core acks it with another IPI, issuing core waits for
ack IPI and then returns.
 
And the IPIs have indirect cost of flushing the processor pipeline.
 
 
My C++ synchronization objects library was updated,
and now i have invented and added the scalable Fast_RWLock and
the scalable Fast_RWLockX and they are better than scalable Asymmetric
RWLocks that use IPIs, and they are costless on the reader side and
they don't use IPIs on the writer side and they are starvation-free, so
they are really powerful, and they are now working with Windows and with
Linux, i have tested thoroughly my C++ synchronization objects library
and i think it is much more stable and fast.
 
You can read about it and download it from my website here:
 
https://sites.google.com/site/scalable68/c-synchronization-objects-library
 
The source code is inside my zip files here(they are called
Fast_RWLockX.pas and LW_Fast_RWLockX.pas):
 
https://sites.google.com/site/scalable68/scalable-rwlock
 
 
 
Thank you,
Amine Moulay Ramdane.
Ralf Goertz <me@myprovider.invalid>: Feb 09 06:43PM +0100

Am Fri, 8 Feb 2019 17:51:30 +0100
> could pass the result to a C++ compiler... And by default it would
> also strip out those pesky zero width spaces. Even in the middle of
> text.
 
Hm, even if C++11 compilers need to treat a source file not ending in a
newline as if it does end in a newline I would still call such a file
ill formed. By the way, vim adds a newline when saving even if no
newline was used on the last line. It also tells you about the fact that
the newline is missing on the last line when it opens the file:
 
"file" [noeol]
 
What a great editor ;-)
ram@zedat.fu-berlin.de (Stefan Ram): Feb 09 03:46PM

>PHP obfuscator in C++ for Linux and Windows. I would like to have same
>source code for Linux and Windows (for easier maintenance of source
>code).
 
Such an obfuscator just needs access to text files. You can
write it without thoughts about specific operating systems
and then compile it using GCC, which is available for
several operating systems. For Windows:
 
ftp.equation.com/gcc/gcc-9-20190203-64.exe (using FTP)
ftp.equation.com/gcc/gcc-9-20190203-32.exe (using FTP)
nuwen.net/mingw.html (using HTTP(S))
 
> Which version of C++ I should use?
 
International standard ISO/IEC 14882, Fith Edition, 2017-12.
 
> Windows version of my program should use GUI and compile to
>32/64 bit binary, not .NET. Linux version should be command line tool.
 
Write a command line tool for both Windows and Linux.
You can always write a GUI wrapper in any language later.
 
Jest więcej słów w języku angielskim, które wymagają
konkretnego artykułu niż w języku polskim. Przy dzisiejszej
technologii tłumaczeniowej nie trzeba już popełniać błędów
językowych.
 
Oh, and if you have "have little experience in C++", don't
use C++, use Python.
viren patel <patel.viren.b1@gmail.com>: Feb 08 06:00PM -0800

hello friends, struggling with finding MFC - CListCtrl equivalent to linux c++ boost. any suggestions please ?
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 09 06:24AM +0100

On 09.02.2019 03:00, viren patel wrote:
> hello friends, struggling with finding MFC - CListCtrl equivalent to linux c++ boost. any suggestions please ?
 
You can use Boost in MFC.
 
 
Cheers!,
 
- Alf
Paavo Helde <myfirstname@osa.pri.ee>: Feb 09 11:00AM +0200

On 9.02.2019 4:00, viren patel wrote:
> hello friends, struggling with finding MFC - CListCtrl equivalent to linux c++ boost. any suggestions please ?
 
Assuming s/to/in/.
 
There are no GUI frameworks like MFC in standard C++ or Boost. If you
want to have a GUI in Linux I would suggest cross-platform GUI
frameworks like Qt or WxWidgets (the latter is pretty MFC-like, mostly
in bad).
 
Or if this is really just a single list control you want to display, it
might be that a common tool like zenity or wish can do the work.
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Feb 09 10:19AM +0100

Am 09.02.2019 um 03:00 schrieb viren patel:
> hello friends, struggling with finding MFC - CListCtrl equivalent to linux c++ boost. any suggestions please ?
 
Just use std::list instrad of CListCtrl - that's the same.
Paavo Helde <myfirstname@osa.pri.ee>: Feb 09 04:26PM +0200

On 9.02.2019 11:19, Jux und Tollerei wrote:
>> hello friends, struggling with finding MFC - CListCtrl equivalent to
>> linux c++ boost. any suggestions please ?
 
> Just use std::list instrad of CListCtrl - that's the same.
 
std::list is an analogue of MFC's CList, not CListCtrl.
Horizon68 <horizon@horizon.com>: Feb 08 07:58PM -0800

Hello,
 
 
> Thanks to many suggestions of people on here and reddit here's the
> event object implementation I came up with:
> http://blog.vorbrodt.me/?p=556
 
Look at my SemaMonitor and my SemaCondvar that i have invented,
you can read about them and find the source code here on my website:
 
https://sites.google.com/site/scalable68/semacondvar-semamonitor
 
 
I have included my SemaMonitor on My C++ synchronization objects library
here:
 
https://sites.google.com/site/scalable68/c-synchronization-objects-library
 
 
Thank you,
Amine Moulay Ramdane.
Horizon68 <horizon@horizon.com>: Feb 08 07:23PM -0800

Hello,
 
 
My C++ synchronization objects library was updated,
and now i have added the scalable Fast_RWLock and
the scalable Fast_RWLockX and they are better than scalable Asymmetric
RWLocks that use IPIs, and they are costless on the reader side,
so they are really powerful, and they are now working with Windows
and with Linux, i have tested thoroughly my C++ synchronization objects
library and i think it is much more stable and fast.
 
You can read about it and download it from my website here:
 
https://sites.google.com/site/scalable68/c-synchronization-objects-library
 
 
Thank you,
Amine Moulay Ramdane.
Horizon68 <horizon@horizon.com>: Feb 08 07:27PM -0800

On 2/8/2019 7:23 PM, Horizon68 wrote:
 
> https://sites.google.com/site/scalable68/c-synchronization-objects-library
 
> Thank you,
> Amine Moulay Ramdane.
 
 
The source code is inside my zip files here(they called Fast_RWLockX.pas
and LW_Fast_RWLockX.pas):
 
https://sites.google.com/site/scalable68/scalable-rwlock
 
 
Thank you,
Amine Moulay Ramdane.
Horizon68 <horizon@horizon.com>: Feb 08 07:28PM -0800

On 2/8/2019 7:23 PM, Horizon68 wrote:
 
> https://sites.google.com/site/scalable68/c-synchronization-objects-library
 
> Thank you,
> Amine Moulay Ramdane.
 
 
I correct a last typo:
 
The source code is inside my zip files here(they are called
Fast_RWLockX.pas and LW_Fast_RWLockX.pas):
 
https://sites.google.com/site/scalable68/scalable-rwlock
 
 
Thank you,
Amine Moulay Ramdane.
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: