Thursday, May 25, 2017

Digest for comp.lang.c++@googlegroups.com - 12 updates in 4 topics

Bo Persson <bop@gmb.dk>: May 25 02:31AM +0200

On 2017-05-24 22:29, Robert Wessel wrote:
> except under the "Visual C++" name. These have all, of course, had a
> C mode. NT 3.51 DD development would likely have been done with MSVC
> 1.5 or 2.0.
 
At least at the time of NT you could get a Device Driver Kit with only
the command line compiler and no Visual Studio.
 
Same compiler though.
 
 
Bo Persson
Robert Wessel <robertwessel2@yahoo.com>: May 24 07:55PM -0500


>At least at the time of NT you could get a Device Driver Kit with only
>the command line compiler and no Visual Studio.
 
>Same compiler though.
 
 
IIRC, VS didn't exist as a product at the time 3.51 was released, and
each of the languages came with (more or less) its own IDE.
 
OTOH, I simply don't remember how the DDK was packaged back them I
did install several, but if they came with the C compiler built in or
added on to a Visual C++ installation, I have no memory.
scott@slp53.sl.home (Scott Lurndal): May 25 12:44PM

>except under the "Visual C++" name. These have all, of course, had a
>C mode. NT 3.51 DD development would likely have been done with MSVC
>1.5 or 2.0.
 
To be fair, I did all my editing using vi on an SVR3 box, and just copied
the source over to the NT machine to compile and test them. The drivers
were for WORM (optical, pre-CD) drives and a WORM jukebox.
David Brown <david.brown@hesbynett.no>: May 25 10:39PM +0200

On 24/05/17 17:05, Alf P. Steinbach wrote:
>> unnecessary.
 
> No, the list was compiled with input from a much larger than noe clc++
> community, at the time.
 
(Scott, I read "noe" as "now", in the sense of "current". "noe" /is/ a
Norwegian word, meaning "something", but that would not make sense in
the context.)
 
 
> Some sillywarnings were added later.
 
> I have somewhere a ditto header for g++, but /that/ one is just my
> personal opinion.
 
In addition to gcc's -Wall and -Wextra, I explicitly turn /on/ several
warnings that are the direct equivalent of some of the ones you are
disabling here. Some of the others I am less sure about, and many do
not have direct gcc equivalents. Note that this is primarily for my own
code - third-party code often does not stick to the same strict
standards as I do, and so I have to loosen my warnings for them.
 
For example, I think it is a /good/ thing to check that all enum values
are handled in a switch. That means that if I add a new value to an
enum, and I forget to handle it in a switch, I get a warning. Each bug
spotted by the compiler is a bug less to find in testing.
 
I don't put functions in my code that are not used - I write for small
embedded systems, and don't want to waste space.
 
If I mark a function as "inline", and it is not inlined, I want to know
about it. (But I don't care if a normal function /is/ inlined by the
compiler.)
 
If padding is added to a struct, I want to know about it.
 
 
It is probably fair to say that disabling most of the warnings on your
list would not be a problem to me. It is unlikely that they would be
triggered by my code (after all, most of what I write is C rather than
C++!). And I think if, for example, a copy constructor cannot be
generated for a class, then that is because of the way you have written
the class. It is only a problem if the copy constructor cannot be
generated, and you need to use it - /that/ is when there needs to be a
warning or error.
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: May 26 12:39AM +0200

On 25-May-17 10:39 PM, David Brown wrote:
> not have direct gcc equivalents. Note that this is primarily for my own
> code - third-party code often does not stick to the same strict
> standards as I do, and so I have to loosen my warnings for them.
 
I agree wholeheartedly with you that reasonable warnings should be
turned on, in general. That was the purpose of the list: to allow one to
use the VC compiler with the highest normal warning level, /W4, without
getting bogged down in an avalanche of system header warnings. Today, if
I were addressing this area I would make a header that /turns on/ some
warnings that the below referenced Microsoft list says are turned off in
VC 2017, in particular the signed/unsigned mismatch warning C4389.
 
 
> are handled in a switch. That means that if I add a new value to an
> enum, and I forget to handle it in a switch, I get a warning. Each bug
> spotted by the compiler is a bug less to find in testing.
 
This was, in 2010, a Visual C++ warning that generated false positives
for code like
 
enum class Enum{ a, b, c, d, e, f };
 
auto foo() -> Enum;
 
auto main() -> int
{
switch( foo() )
{
case Enum::a: return 10;
case Enum::b: return 20;
default:
break;
}
return 30;
}
 
When one uses `default:` in a `switch` then that means that one is
handling every other value. But Visual C++ didn't see it that way: the
VC designers thought that it was a good idea to warn about the use of
`default:`, for what if it had been placed there by, say, a copy/paste
error, or sumthin'?. Hence in 2010 it was a negative value sillywarning.
 
With Visual C++ 2017 that warning, C4061, has been /turned off/ by
default. Presumably for the same reason as my sillywarnings-list. See
the list at
<https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default>;
as it happens this warning is on top.
 
I think this shows that for this particular concrete example you're
arguing from ignorance, due to simply not having much experience with
this compiler and its idiosyncrasies.
 
 
 
> If I mark a function as "inline", and it is not inlined, I want to know
> about it. (But I don't care if a normal function /is/ inlined by the
> compiler.)
 
`inline`'s effect on inlining of calls is just a hint. Its main purpose,
and its only guaranteed effect, is to ensure that a function can be
defined in a header; technically, that it can be defined in the same
way, with extern linkage, in multiple translation units. When the
keyword is used for that guaranteed effect, or when a member function is
defined in the class definition (which implicitly gives it `inline`),
you really don't want the compiler spewing out diagnostics about
ignoring the additional vague hint semantics.
 
So here you're evidently doing something wrong.
 
Where you want an all-out effort to inline a call (I think it's better
to let the compiler decide, but let's say profiling says that the
compiler didn't inline where it should, and that it's critical), use the
appropriate compiler specific magic invocation. Standard C++ doesn't
have that feature; relying on `inline` to do /that/ job is not portable.
But the compiler-specific can be wrapped in a macro for portability.
 
This warning, C4710, is also off by default in Visual C++ 2017.
 
 
> If padding is added to a struct, I want to know about it.
 
No, really, you don't. Padding is added to most structs. Only if you
have designated the struct as packed, is such a warning useful.
 
And also this warning, C4820, is one of those that now are off by default.
 
I.e. for the three warnings so far, Microsoft have, wisely IMHO, agreed
with the sillywarnings list. :-)
 
 
> C++!). And I think if, for example, a copy constructor cannot be
> generated for a class, then that is because of the way you have written
> the class.
 
No, that could be e.g. `boost::noncopyable`.
 
 
> It is only a problem if the copy constructor cannot be
> generated, and you need to use it - /that/ is when there needs to be a
> warning or error.
 
Yes, I agree, but Visual C++ has had a habit of emitting these
diagnostics whenever, as it looks from a purely local context ignoring
everything else, they /might/ apply.
 
 
Cheers & hth.,
 
- Alf
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: May 25 04:52AM -0700

This world is run by evil madmen being guided by an insane evil spirit
named Satan. The purpose of all of Satan's actions are to do the
opposite of that which God established, and to teach contrary things
to that which God established.
 
I would like to request help in changing that.
 
The Lord Jesus Christ came to this Earth to restore that which was
lost because of sin. He did that at the cross, having fulfilled all
He was tasked to do completely, and faithfully, even though it was a
most bitter cup He was forced to drink from.
 
We now in this world have a choice. We can continue on in the way and
ways of the world, or we can recognize them for what they are (evil),
and choose to go another way.
 
I am asking each of you to consider the direction you want this world
to go in, and make a conscious choice to put your talents and skills
where your mouth is, and step up in this world and serve the Lord Jesus
Christ directly with your life's focus. Together, we can achieve that
which none of us can achieve on our own.
 
I offer my talents and skills and knowledge and resources unto the
Lord, and I'm asking you to join with me in moving forward with projects
that seek to honor Him in this world. Consciously. Purposefully. By
a concerted, focused effort desiring to turn our backs on the evil ways
of this world, and embrace the holy, right, and true ways taught by the
Lord Jesus Christ.
 
Everything He has taught us and done for us is right, pure, holy, and
that very and exact thing we all need in our lives. I choose to embrace
fully His presence in my life, and to bring Him out front ahead of the
things I do, so that I am not doing them for myself, for money, for some
kind of fame or glory, but I am instead doing it because I recognize He
first made me, and gave me my skills, and gave me every opportunity I've
had to move in this world. And I want to give back to Him that which He
first gave me, as an offering of my free will because of who He is.
 
I invite each of you to step up and come and join this project I am
working on. It has been a monumental undertaking, and I have been
diminished in my ability to continue working on it over time. I am not
sure the cause of that diminishment, but I know that together we can
achieve that which He first placed upon my heart:
 
A full hardware and software stack, with our own protocols and
specifications that are unencumbered by existing patents and IP
constraints:
 
(1) CPU
(2) Mainboard components
(3) Memory
(4) Networking, video, sound
(5) Operating system
(6) Drivers
(7) Tools (editors, compilers, debuggers, script engines)
(8) Applications
(9) Physical manufacturing of all of these things
 
We have the skills. We have the talent. We can tear down and rebuild
that which the enemy constructed on false foundations. We can make
ours fully secure upon eternal foundations.
 
I am asking you to come forth with your life's offering and serve the
Lord. I'm asking you to come to His Son and ask forgiveness of your
sin and then begin your life anew in service to Him.
 
The enemy won't like this, and he will come and attack from all sides.
But God is far greater, and if you stay the course, God Himself will
ensure your success ... because of who He is, and because of who you
are in Him.
 
Thank you for considering this proposal. Feel free to email me if
you would like. I look forward to hearing from you.
 
Thank you,
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: May 25 06:36AM -0700

On Thursday, May 25, 2017 at 7:52:27 AM UTC-4, Rick C. Hodgin wrote:
> are in Him.
 
> Thank you for considering this proposal. Feel free to email me if
> you would like. I look forward to hearing from you.
 
Someone in another group posted this:
 
-----
In comp.arch.fpga:
On Thursday, May 25, 2017 at 9:05:23 AM UTC-4, Evgeny Filatov wrote:
> > (8) Applications
> > (9) Physical manufacturing of all of these things
 
> So... what has been your progress so far?
 
They're all works in progress at various stages of completion.
 
CPU design:
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/arxoda/core
 
FPGA design:
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/arlina
 
Video hardware:
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/arxoda/core/video/video_controller.png
 
OS kernel:
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/exodus/source
http://www.visual-freepro.org/videos/2014_02_13__exodus_debi_debugger.ogv
 
C-like software language:
https://groups.google.com/forum/#!forum/caliveprogramminglanguage
https://groups.google.com/forum/#!forum/rapid_development_compiler
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/exodus/tools
 
And I have other apps I've worked on, and hardware:
 
Font system:
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/utils/dsf
 
Database system:
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/source/vjr
 
Automotive fuel injection system, with in-progress simulation:
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/source/superjet
http://www.libsf.org/images/superjet/superjet_feb_18_2017.avi
 
IBM Model-F buckling spring style keyboard manufacturing:
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/king
http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/king/keyboard_designs.png
 
And I have other ideas and projects mapped out, including a non-linear
on-the-fly video / audio editor called Whitebox, the purpose of which
is to apply user edits to raw content decoded from a DVD, so you pop
in a DVD which is an R-rated movie due to profanity and/or violence,
but one which otherwise has a good message and good scenes, and by
applying on-the-fly edits, you wind up with a G-rated version suitable
for the family. And I have ideas for how to create a Blender-like
app, a GIMP-like app, as well as a full office suite, etc.
 
Thank you,
Rick C. Hodgin
bitrex <bitrex@de.lete.earthlink.net>: May 25 04:04PM -0400

On 05/25/2017 09:36 AM, Rick C. Hodgin wrote:
>> named Satan. The purpose of all of Satan's actions are to do the
>> opposite of that which God established, and to teach contrary things
>> to that which God established.
 
Sounds about right
 
> app, a GIMP-like app, as well as a full office suite, etc.
 
> Thank you,
> Rick C. Hodgin
 
How are the cut points determined? The reason most movies that are rated
"R" get that rating is because there was so much violence they couldn't
edit it down to "PG-13" and have it still make sense. That or someone
showed a boob once for 3 seconds.
 
I can't think of many films worth watching by anyone, family or
otherwise, in the past 20 years that had a "good message" that also got
an "R" rating. Saving Private Ryan, maybe.
 
I swore off Hollywood dribble 99% many years ago, feels great without it
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: May 25 01:50PM -0700

On Thursday, May 25, 2017 at 4:04:36 PM UTC-4, bitrex wrote:
> > for the family. And I have ideas for how to create a Blender-like
> > app, a GIMP-like app, as well as a full office suite, etc.
 
> How are the cut points determined?
 
The databases that are applied to the live Whitebox edits are provided
by the community. They can be downloaded, options selected, new edits
added, unwanted edits removed, etc., and they go into a database where
people can search and make comments and notes.
 
All of this is spec'd out, but none of it exists yet. My whole goal
was to allow modified editing of purchased content, so the movie
studios have no reason to complain because they're still getting
money for their movie, and people are able to see/hear only what
they want to.
 
> I can't think of many films worth watching by anyone, family or
> otherwise, in the past 20 years that had a "good message" that
> also got an "R" rating. Saving Private Ryan, maybe.
 
Most films have enough content in them I don't want to watch them
either (G on up). Some entire themes need to be removed. The
same is true for TV shows, and Whitebox would work on TV shows.
 
I like many stories and the writing on The West Wing writing,
Numb3rs, but they have too many sub-themes which are inappropriate.
I would Whitebox those out entirely.
 
Even shows like Star Trek Enterprise, edit out every decon chamber
scene, every sexual reference, every neural pressure therapy scene
between T'Pol and Trip, and so on.
 
And the list goes on.
 
In most cases, remove up to 20% of the content, and it's then a
G-rated show with all sub-themes removed, suitable for the family.
This is on a movie that is already family-targeted, of course.
It wouldn't work with The Terminator or other such movie.
 
> I swore off Hollywood dribble 99% many years ago, feels great
> without it
 
Me too. But there are some movies I would like to see again, but
can't watch because of language or various few scenes.
 
I have manually edited some movies down to have just the G-rated
content. Two in particular are:
 
Real Genius 1985: http://www.imdb.com/title/tt0089886/
By The Sword 1991: http://www.imdb.com/title/tt0101524/
 
And I'm working on:
 
Ice Station Zebra 1968: http://www.imdb.com/title/tt0063121/
The American President: http://www.imdb.com/title/tt0112346/
 
I also plan on working The West Wing seasons 1-4, Numb3rs, Sports
Night, and possibly Northern Exposure. But, those are really far-
off long-term plans that I will get to someday (if I do).
 
Thank you,
Rick C. Hodgin
Tim Rentsch <txr@alumni.caltech.edu>: May 25 06:51AM -0700


> Your version is less obvious to me, what with the recursion and
> general indirection, even though I've read a few Lisp and functional
> programming books [...].
 
Delegating constructors fit nicely into a functional/recursive
approach, but they have an important limitation in that they must
be unconditional. That means we must have a helper function in
some cases to calculate values for the member variables. Here
the code is taking advantage of the property that once the number
of leading ones is known, it's easy to mask off the leading ones
from the original parameter value, using a simple expression.
That leaves the recursive function high_ones(). I think it's
pretty easy to read functions like this once you get the hang of
it. Case in point: if we see this
 
return bits & mask ? high_ones( n+1, bits, mask>>1 ) : n;
 
we might think of it as a loop
 
while ( bits & mask ) {
n += 1, mask >>= 1;
}
return n;
 
which may help bridge the gap until the recursive writing becomes
more natural.
 
One advantage of adopting a functional/recursive approach is that
it provides a way of "looping" in functions but which still can
be 'constexpr'.
 
 
> functional programming like in Lisp), it's the precedence of the C++
> `^`, `<<` and infix `-` operators. I'd had to look that up to be
> sure!
 
Here's an easy way to remember (for operators that are also in C,
which holds in this case). Binary operators all group in ways
that are natural and sensible given what they do, except for the
bitwise operators. Bitwise operators form a "sandwich" around
the relational/equality operators: shift operators have higher
precedence, and bitwise-logic operators have lower precedence.
The two kinds of shift have the same precedence; the three kinds
of bitwise-logic operations each have their own level: & and |
parallel && and ||, and ^ is inbetween. The logic operations
having lower precedence than relational/equality operators is a
historical artefact of early C not having && and ||, so it made
sense (then, not now) for & and | to be "lower" than ==, etc,
for boolean combination of conditions.
 
Here is a variation on the previous class definition - the helper
function calculates both member values at once, packing them into
a single 'unsigned long long' value for subsequent extraction.
Notice the private constructor needs to be 'explicit' in this
case, to avoid an overloading ambiguity.
 
typedef unsigned char Byte;
 
struct EncodedByte {
int const n_leading_ones;
Byte const low_bits;
 
constexpr
EncodedByte( char c )
: EncodedByte( two_parts( 0, c & 255u, 0x80 ) )
{}
 
private:
typedef unsigned Bits;
typedef unsigned long long ULL;
 
explicit constexpr
EncodedByte( ULL upper_lower )
: n_leading_ones( upper_lower >> 8 )
, low_bits( upper_lower & 255 )
{}
 
static constexpr ULL
two_parts( ULL n, Bits b, Bits m ){
return b & m ? two_parts( n+1, b^m, m>>1 ) : n<<8 | b;
}
};
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: May 25 04:30PM +0200

On 25-May-17 3:51 PM, Tim Rentsch wrote:
 
> One advantage of adopting a functional/recursive approach is that
> it provides a way of "looping" in functions but which still can
> be 'constexpr'.
 
Oh, this was relaxed in C++14.
 
E.g. the following code compiles fine with g++ (but Visual C++ 2017
lacks support):
 
constexpr
auto sum_to( int const n )
-> int
{
int sum = 0;
for( int i = 1; i <= n; ++i ) { sum += i; }
return sum;
}
 
#include <stdlib.h>
auto main()
-> int
{
constexpr int n = 42;
char const a[sum_to( n )]{};
return (sizeof(a) == n*(n + 1)/2? EXIT_SUCCESS : EXIT_FAILURE);
}
 
Thanks for your comments, third approach for the problem, and further
help about how to remember operator precedence (snipped here). :)
 
 
Cheers!,
 
- Alf
Bonita Montero <Bonita.Montero@gmail.com>: May 25 10:11AM +0200

According to your posing-length you must be severely manic.
Go to a doctor.
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: