Sunday, July 22, 2018

Digest for comp.lang.c++@googlegroups.com - 6 updates in 3 topics

Ian Collins <ian-news@hotmail.com>: Jul 22 01:59PM +1200


>> There have been, c++14 and C++17, which includes std::string_view.
 
> I don't think all of those are needed -- the last two
> standards seem to be producing mixed results.
 
C++14 was as much a bug fix and clean up of C++11 as anything, so it's
an incremental improvement. I see no evidence of it producing mixed
results, what have you seen?
 
C++17 is new, so the jury is still out.
 
--
Ian.
Vir Campestris <vir.campestris@invalid.invalid>: Jul 22 09:29PM +0100

On 20/07/2018 14:10, Scott Lurndal wrote:
 
> False analogy.
 
> In any case, there is quite a bit of C code still being developed
> and maintained.
 
Unless you are seriously resource constrained I think C++ is a better
tool than C. But C still has its place.
 
I can't imagine why you should want to use a tool that was designed back
in the 1970s (or maybe 1988) these days, unless you have to. I use VI
from time to time - git checkins, for example. But there are better
editors for more complex work.
 
But I guess we'll have to agree to differ on this :)
 
Andy
Bart <bc@freeuk.com>: Jul 22 12:41AM +0100


> Wow, lazy evaluation instead of a proper if() and nested ? operators with comma
> seperated multiple statements. And I thought Alfs code was an unmaintainable
> mess but he has nothing on this guy.
 
I /think/ that code is structured something like the following:
 
if (!Mark || Secs>(Mark+3)) {
Mark = Secs;
Cnt = 1;
} else
if (++Cnt>3) {
Mark = Secs;
Cnt = 1;
Keyboard = FindWindows(0,"...");
if (Keyboard) {
SendMessage(Keyboard,274,0,0);
} else {
0;
}
Launch("...");
} else {
0;
}
}
 
If so, then those dummy 0 expressions might only be there as the
required third operand of ?:, so are not really necessary:
 
if (!Mark || Secs>(Mark+3)) {
Mark = Secs;
Cnt = 1;
} else
if (++Cnt>3) {
Mark = Secs;
Cnt = 1;
Keyboard = FindWindows(0,"...");
if (Keyboard) {
SendMessage(Keyboard,274,0,0);
}
Launch("...");
}
}
 
This still takes double the number of lines, but is much easier to follow.
 
(Here I admit I cheated by using a tool to decipher the structure. But
you shouldn't need to use any tool.)
 
--
bart
Jeff-Relf.Me @.: Jul 22 10:17AM -0700

boltar@cylonHQ.com: Jul 22 08:43AM

On Fri, 20 Jul 2018 20:11:12 +0200
 
>> the world.
 
>Your numbering is confused. Probably 90% or more of C or C++
>programmers use one of these three compilers. But there are a great
 
Agreed, that probably is a better way of putting it, my mistake.
 
>> Feel free to mention any others that matter that default to C99.
 
>Why would "defaults to C99" have the slightest significance? Neither
 
Because I mentioned the fact that even modern compilers require a switch
to operate in C99 mode and even now the de facto C standard is C89.
 
>> B) You don't have a main() function at all
 
>I have only twice seen an embedded C program without a main() function -
 
You've obviously never programmed an arduino then :)
David Brown <david.brown@hesbynett.no>: Jul 22 01:26PM +0200


>>> B) You don't have a main() function at all
 
>> I have only twice seen an embedded C program without a main() function -
 
> You've obviously never programmed an arduino then :)
 
I work with real embedded systems, not toys. I usually only see
Arduinos in terms of potential customers who have got a vague prototype
or proof of concept using an Arduino, and want to develop a product.
 
Arduinos are great for getting people interested in embedded
programming, and have spawned a wide selection of off-the-shelf cards
for prototyping, but they have a counter-productive design for the
development system. It combines the worst of C with the worst of C++,
hides all the useful stuff in the toolchain, skimps over important
details so that people who learned with Arduino can't program on other
systems, and gives a false impression that embedded development is
something quick and easy. If you understand the limitations of the
system, it can be a useful idea - if not, it is worse than useless.
 
And Arduino programs have a "main()". It is just hidden from the user.
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: