Tuesday, July 17, 2018

Digest for comp.lang.c++@googlegroups.com - 13 updates in 5 topics

Vir Campestris <vir.campestris@invalid.invalid>: Jul 17 11:14PM +0100

On 17/07/2018 10:09, Rosario19 wrote:
> the leak can be in C++ even if there are no leak,
> if the allocator (malloc()/free() or new()/delete()) not has one algo
> for return to OS the memory (zeroed first) that can
 
I'm sorry, I'm not sure I understand you.
 
Heap management at the malloc/free level has been pretty much bug free
for 30 years or so.
 
Andy
Paavo Helde <myfirstname@osa.pri.ee>: Jul 18 01:40AM +0300

On 18.07.2018 1:14, Vir Campestris wrote:
 
> I'm sorry, I'm not sure I understand you.
 
> Heap management at the malloc/free level has been pretty much bug free
> for 30 years or so.
 
I believe he/she/it is talking about the program not releasing freed
memory back to OS. This can be caused by memory fragmentation, small
leaks or just failing to call a special function for it
(scalable_allocation_command(TBBMALLOC_CLEAN_ALL_BUFFERS, NULL) for TBB,
for example).
gof@somewhere.invalid (Adam Wysocki): Jul 17 08:59PM

Hi,
 
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), I know and agree with arguments against
indentation and in simple cases I don't feel it affects readability, but
in more complicated ones, where there are many nested namespaces, it
easily becomes a mess...
 
I know it's a matter of personal preference (or rules agreed by the team),
but I'm curious what your preference is, and why.
 
--
[ Adam Wysocki :: Warsaw, Poland ]
[ Email: a@b a=grp b=chmurka.net ]
[ Web: http://www.chmurka.net/ ]
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 17 11:01PM +0100

On 17/07/2018 21:59, Adam Wysocki wrote:
> easily becomes a mess...
 
> I know it's a matter of personal preference (or rules agreed by the team),
> but I'm curious what your preference is, and why.
 
namespace foo::bar::baz
{
}
 
/Flibble
 
--
"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."
Vir Campestris <vir.campestris@invalid.invalid>: Jul 17 11:19PM +0100

On 17/07/2018 23:01, Mr Flibble wrote:
 
> namespace foo::bar::baz
> {
> }
 
I indent them all
so
namespace foo
{
class bar
{
}
}
 
I seem to be in a minority.
 
Andy
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jul 17 03:18PM -0400

> Getting rid of that is one thing Windows could do to be
> less annoying. They should have done it 10 years ago
> though.
 
WSAStartup() is only required for apps that use windows
sockets. Other apps have no need for it, so why would
every app auto-call it?
 
--
Rick C. Hodgin
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jul 17 09:25PM +0200

> Getting rid of that is one thing Windows could do to be
> less annoying. They should have done it 10 years ago
> though.
 
WSAStartup is an initialization of the Winsocks library. It's needed if
you use Winsocks, and not otherwise. The only library that every Windows
desktop program has to use is Kernel32, because it provides the
ExitProcess function.
 
Undocumented: you can simply return instead of calling ExitProcess. Or
at least that used to be the case. It's been some years.
 
 
Cheers & hth.,
 
- Alf
Lynn McGuire <lynnmcguire5@gmail.com>: Jul 17 02:36PM -0500

On 7/17/2018 12:47 PM, Richard wrote:
 
> ...but back to the topic of the article. This is like the 40th time
> that someone has complained about C++ and introduced a new language to
> "solve" the problems that C++ has.
 
Shoot, it could the 400th time.
 
Lynn
Ian Collins <ian-news@hotmail.com>: Jul 18 08:27AM +1200

On 18/07/18 06:16, Scott Lurndal wrote:
>> on linux.
 
> Hm. Never even heard it referred to outside of this usenet forum.
 
> Well respected by who in the linux community?
 
All of our native Linux developers except for me and probably most
others who come from a windows background.
 
> We have many linux programmers internally, and aside from a couple
> of interns who used eclipse, everyone else uses vim or emacs.
 
The same Linux programmers who don't know how to use smart pointers
efficiently?
 
--
Ian.
woodbrian77@gmail.com: Jul 17 01:47PM -0700

On Tuesday, July 17, 2018 at 2:19:02 PM UTC-5, Rick C. Hodgin wrote:
 
> WSAStartup() is only required for apps that use windows
> sockets. Other apps have no need for it, so why would
> every app auto-call it?
 
I know. I don't want to have to call it at all.
 
 
Brian
woodbrian77@gmail.com: Jul 17 01:24PM -0700

On Tuesday, July 17, 2018 at 9:16:53 AM UTC-5, Alf P. Steinbach wrote:
> --------------------------------------------------------------------------
 
> Output:
 
> initializer_list
 
I was thinking it would output
One int arg
 
there, but that's just based on what you said
about "the C++ constructor overload resolution
logic will default to interpret any "{ ... }" argument list
with two or more arguments, as an initializer_list"
 
 
 
> E.g. `std::vector` and `std::string` have this problem because these
> standard library classes were designed before `std::initializer_list` (a
> curly brace enclosed list of values) was introduced in C++11...
 
Jason Turner gave a talk about fixing initializer lists,
but I haven't watched it.
 
 
Brian
Ebenezer Enterprises
https://github.com/Ebenezer-group/onwards
Ian Collins <ian-news@hotmail.com>: Jul 18 08:30AM +1200


>> So removing something that has no cost is a sound engineering decision?
 
> There's no such thing as no cost in creating and destructing objects no matter
> how slimline they may be and smart pointers are objects.
 
Sure there's a cost, the exact same cost as duplicating the behaviour by
hand, over and over again..
 
--
Ian.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jul 17 03:26PM -0400

Somebody posted on comp.lang.asm.x86 an algorithm for fizz buzz.
It made me think of one here in C/C++.
 
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
 
void fizz(int num) { printf("fizz\n"); }
void buzz(int num) { printf("buzz\n"); }
void fizzbuzz(int num) { printf("fizzbuzz\n"); }
void other(int num) { printf("%d\n", num); }
 
struct STargets { void (*func)(int num); };
struct STargets funcs[4] = { other, fizz, buzz, fizzbuzz };
 
// Cycling bit patterns
uint32_t three_data = 0x924;
uint32_t five_data = 0x84210;
 
int main(int argc, char* argv[])
{
for (int lnI = 1; lnI <= 100; ++lnI)
{
funcs[(three_data & 1) + (2 * (five_data & 1))].func(lnI);
 
three_data = (three_data >> 1) | ((three_data & 1) << 11);
five_data = (five_data >> 1) | ((five_data & 1) << 19);
}
return(0);
}
 
The rules of the FizzBuzz game are here:
 
http://wiki.c2.com/?FizzBuzzTest
 
--
Rick C. Hodgin
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: