- XKCD: I hate reading your code - 6 Updates
- A new algorithm of an efficient Threadpool engine that scales well - 3 Updates
- My unit that implements processor groups on windows - 1 Update
- XKCD: I hate reading your code - 11 Updates
- boost::regex_relace vs. std::regex_replace: Who is right? - 2 Updates
- overloaded functions if insufficient arguments? - 2 Updates
ram@zedat.fu-berlin.de (Stefan Ram): Jun 21 07:11PM >>char* p; >Now it's telling the truth, if I understand your example >correctly. And which »truth« do you read in: char* p, q; ? |
ram@zedat.fu-berlin.de (Stefan Ram): Jun 21 07:21PM >>char* p, q; >>? >The truth that you should never declare more than one variable per line! Then make that char* p, q; . |
ram@zedat.fu-berlin.de (Stefan Ram): Jun 21 07:33PM >return- 1; >because the * is part of a declarator and is associated with the name, >not the type specifier. And that's why I write int main( void ) { puts( "This is for comp.lang.c." ); } , instead of int main( void ) { puts( "This is for comp.lang.c." ); } : A C function definition (6.9.1) consists of two parts, first, declaration-specifiers declarator declaration-list/opt (the head of the function) and, second, a compound-statement (the body of the function); so there is no need to write /the first character of the compound statement still on the preceding line/, the line break clearly needs to be at the structural boundary /in front of/ the compound statement, between the head and the body of the function definition. I also call it »structured formatting« because it makes the syntactical structure visible in the formatted source code. |
bleachbot <bleachbot@httrack.com>: Jun 21 10:33PM +0200 |
bleachbot <bleachbot@httrack.com>: Jun 21 11:00PM +0200 |
bleachbot <bleachbot@httrack.com>: Jun 21 11:07PM +0200 |
Ramine <ramine@1.1>: Jun 21 01:35PM -0700 Hello, A new algorithm of an efficient Threadpool engine that scales well I have implemented this new algrithm of a Threadpool engine that scales well, i have enhanced it to support processor groups on windows, so that it scales with more that 64 logical cores, and i have also minimized at best the contention so that it scales well. The following have been added to my efficient Threadpool engine: - The worker threads enters in a wait state when there is no job in the concurrent FIFO queues - for more efficiency - - You can distribute your jobs to the worker threads and call any method with the threadpool's execute() method. - It uses work-stealing to be more efficient. - You can configure it to use stacks or FIFO queues , when you use stacks it will be cache efficient. - Now it can use processor groups on windows, so that it can use more than 64 logical processors and it scales well. - Now it distributes the jobs on multiple FIFO queues or stacks so that it scales well. - You can wait for the jobs to finish with the wait() method. - And it is portable to many operating systems. You can download my efficient Threadpool engine version 3.0 that scales well from: https://sites.google.com/site/aminer68/an-efficient-threadpool-engine-that-scales-well Thank you, Amine Moulay Ramdane. |
Mr Flibble <flibble@i42.co.uk>: Jun 21 10:04PM +0100 On 21/06/2016 21:35, Ramine wrote: > You can download my efficient Threadpool engine version 3.0 that scales > well from: > https://sites.google.com/site/aminer68/an-efficient-threadpool-engine-that-scales-well This is a C++ newsgroup not a Pascal newsgroup so stop posting Pascal crap here. /Flibble |
Ramine <ramine@1.1>: Jun 21 02:07PM -0700 On 6/21/2016 2:04 PM, Mr Flibble wrote: > This is a C++ newsgroup not a Pascal newsgroup so stop posting Pascal > crap here. > /Flibble I have posted here, because it is a new algorithm that can be ported to C++. Thank you, Amine Moulay Ramdane. |
Ramine <ramine@1.1>: Jun 21 02:00PM -0700 Hello, My unit that implements processor groups on windows I have implemented a unit that implements processors groups, this unit contains a class that easy for you to support processor groups on windows that allows you to use more than 64 logical processors on windows, this class doesn't exist in C++, i have implemented it in Object Pascal with the Delphi and FreePascal compilers. Please look inside the zip file of the Threadpool engine that scales well , its source code is inside the ProcessorGroups.pas file. To know how to use it, please look at the test2.pas example inside the zip file and look inside the source code to understand more my class. You can download it from here: https://sites.google.com/site/aminer68/an-efficient-threadpool-engine-that-scales-well Thank you, Amine Moulay Ramdane. |
Johann Klammer <klammerj@NOSPAM.a1.net>: Jun 21 09:21AM +0200 On 06/20/2016 07:09 PM, Lynn McGuire wrote: > "Ponytail: It's like you ran OCR on a photo of a Scrabble board from > a game where Javascript reserved words counted for triple points." > Lynn Everyones code is ugly. The problem is that on some indentation it will always look like a complete mess, and no codez conforms to every coding standard out there. |
legalize+jeeves@mail.xmission.com (Richard): Jun 21 05:48PM [Please do not mail me a copy of your followup] Johann Klammer <klammerj@NOSPAM.a1.net> spake the secret code >Everyones code is ugly. I disagree. I don't consider the code shown in K&R C Programming Language to be ugly. Yet oddly enough, a huge portion of the C/C++ community doesn't follow the style of the authors of the language(s). Having written code that was formatted into a book, there is some tension between "layout of code for publication" and "layout of code for a functioning system", but it isn't too much. Mostly I found that I had to use shorter line lengths than I would normally. I didn't want the size of the font for code samples to differ drastically in size from the regular font used for prose. The X Window System distributions from MIT were a *huge* amount of code worked on by a *huge* number of people. Yet all of it appeared as if it were written by a single person and had consistent naming and indent styles. Other than the sheer amount of it, working on that code base was enjoyable. (It's been years since I perused at any significant depth the X Window System source distributions, they may have diverged from their previous understandability.) LLVM/Clang is also consistent, mostly through imposition of a style coming from an automated tool (clang-format). I'm not a fan of the style rules they've chosen (they chafe against almost all of my personal preferences), but at least it's consistent throughout due to their use of an automated tool. Therefore, working on that rather large code base is a predictable experience. Consistency can be taken to absurd limits, however. I defer generally to Item 0 of "C++ Coding Standards" by Sutter and Alexandrescu: Don't Sweat the Small Stuff <http://amzn.to/28O2yxE>. I once worked on a team where a member insisted that: char *p; was *completely* illegible (this is a direct quote) compared to: char* p; This is the complete opposite of Item 0. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Computer Graphics Museum <http://computergraphicsmuseum.org> The Terminals Wiki <http://terminals.classiccmp.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
Jos Bergervoet <jos.bergervoet@xs4all.nl>: Jun 21 08:53PM +0200 On 6/21/2016 7:48 PM, Richard wrote: > team where a member insisted that: > char *p; > was *completely* illegible Well, of course you can read it, but then you read the wrong message: that there is a char, which is called *p. The truth is of course that there is a char*, which is called p. > ... (this is a direct quote) compared to: > char* p; Now it's telling the truth, if I understand your example correctly. -- Jos |
BartC <bc@freeuk.com>: Jun 21 08:00PM +0100 On 21/06/2016 19:53, Jos Bergervoet wrote: >> char* p; > Now it's telling the truth, if I understand your example > correctly. Until someone types: char* p, q; then it's lying again. Because there aren't two char* called p and q. -- bartc |
Noob <root@127.0.0.1>: Jun 21 09:16PM +0200 On 21/06/2016 20:53, Jos Bergervoet wrote: >> char* p; > Now it's telling the truth, if I understand your example > correctly. OK, so when you have char* p, q; What's the type of q? Regards. |
legalize+jeeves@mail.xmission.com (Richard): Jun 21 07:16PM [Please do not mail me a copy of your followup] Jos Bergervoet <jos.bergervoet@xs4all.nl> spake the secret code >> char* p; >Now it's telling the truth, if I understand your example >correctly. Both are "true". Neither is false. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Computer Graphics Museum <http://computergraphicsmuseum.org> The Terminals Wiki <http://terminals.classiccmp.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
Lynn McGuire <lmc@winsim.com>: Jun 21 02:17PM -0500 On 6/21/2016 12:48 PM, Richard wrote: > was *completely* illegible (this is a direct quote) compared to: > char* p; > This is the complete opposite of Item 0. I prefer "char * p;" due to my vision issues. I have trouble seeing the asterisk by itself. Lynn |
Ian Collins <ian-news@hotmail.com>: Jun 22 07:18AM +1200 On 06/22/16 07:11 AM, Stefan Ram wrote: > And which »truth« do you read in: > char* p, q; > ? The truth that you should never declare more than one variable per line! -- Ian |
Lynn McGuire <lmc@winsim.com>: Jun 21 02:20PM -0500 On 6/21/2016 2:18 PM, Ian Collins wrote: >> char* p, q; >> ? > The truth that you should never declare more than one variable per line! Amen! Preach on brother! And define that pointer to be NULL. Lynn |
Ben Bacarisse <ben.usenet@bsb.me.uk>: Jun 21 08:20PM +0100 Jos Bergervoet <jos.bergervoet@xs4all.nl> writes: I note the cross post (but why Fortran?). This is an issue that often separates C and C++ programmer so I worry that it could run and run... > wrong message: that there is a char, which is called *p. > The truth is of course that there is a char*, which is > called p. To a first approximation they are both true. Neither can be used yet because p is indeterminate but, in general, given a valid p, there is indeed a char called *p. >> char* p; > Now it's telling the truth, if I understand your example > correctly. To me it grates because of the syntax rules. It's like writing return- 1; because the * is part of a declarator and is associated with the name, not the type specifier. But then I should be dragged off in chains because I write (in C) things like char buf[SZ], *cp = buf, *ep = buf + SZ; (And I'm not insensitive to the irony of replying to a post that gave this as an example of something not to care about!) -- Ben. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jun 21 10:30PM +0200 On 21.06.2016 21:16, Noob wrote: > OK, so when you have > char* p, q; > What's the type of q? You just write Ptr_<char> p, q; where template< class T > using Ptr_ = T*; Cheers & hth., - Alf |
Ralf Goertz <me@myprovider.invalid>: Jun 21 10:29AM +0200 Am Mon, 20 Jun 2016 05:58:28 -0700 (PDT) > Best is to assume that 'boost::regex_replace' and > 'std::regex_replace' are totally different functions and those having > something in common is purely accidental. Well, isn't boost the forerunner in implementing new features that later become standard? So I would like to think that these to function are merely two implementations of the same (standard) thing. > be (I'm speculating now) some sort of difference. For example that > the 'format_default' means slightly different things for 'boost' and > 'std'. Yeah, but so far I have failed to find a standard or boost document that mentions explicitely that I have to escape the backslash. The only hint given by someone at stackoverflow is that boost does it the perl way and in perl we also need to escape '\' in the replacement string. I only have gcc at hand I don't really know what the standard says. It might still be that boost is correctly interpreting the standard and the gcc got it wrong. That's my real question. What is the right behaviour of that function according to the standard? > Such differences are no problem but the endless source of work (and so > bread) for you. ;-) Well, for me the are indeed a pain in the ass because I am not paid to write code per se but to solve problems. For that I write c++ programs and try to stick to the standard. |
"Öö Tiib" <ootiib@hot.ee>: Jun 21 09:19AM -0700 On Tuesday, 21 June 2016 11:29:48 UTC+3, Ralf Goertz wrote: > Well, isn't boost the forerunner in implementing new features that later > become standard? So I would like to think that these to function are > merely two implementations of the same (standard) thing. You seem to think that first there is standard and then boost. Actually it is other way around. Boost was made for to produce candidates of classes and libraries into C++ standard library. It is quite successful in that. That does not mean that successful candidate is accepted into standard library without changes. It seems more common that there are some changes. Also, Boost tries to be platform-neutral so usually there will be several platform-specific implementation after something of it is standardized. > mentions explicitely that I have to escape the backslash. The only hint > given by someone at stackoverflow is that boost does it the perl way and > in perl we also need to escape '\' in the replacement string. I have also read gossip that boost had some Perl-like features to that "ECMAScript" that std::regex is not required to contain but i'm unsure if it is about those backslashes. > might still be that boost is correctly interpreting the standard and the > gcc got it wrong. That's my real question. What is the right behaviour > of that function according to the standard? Perl is not mentioned anywhere. I see "ECMAScript", "POSIX BRE", "POSIX ERE", "grep", "egrep" and "awk" mentioned. > Well, for me the are indeed a pain in the ass because I am not paid to > write code per se but to solve problems. For that I write c++ programs > and try to stick to the standard. When you write programs to solve problems then what a function or library is documented to do is likely less important than what it actually does. These two things are never exactly same and also both documentation and behavior will change over time. Also, what problem needs usage of both boost::regex and std::regex in mix? |
pedro1492@lycos.com: Jun 21 03:20AM -0700 I was looking through an open-source train wreck, and a certain function is overloaded. There are 4 definitions of the function with 3,4,5 or 7 arguments. Now the function with this name is called with 3,4,6 or 7 arguments. The call with 6 arguments has used the first 6 of the 7 definition but dropped the last argument (integer). So will it just zero for the missing argument? |
Victor Bazarov <v.bazarov@comcast.invalid>: Jun 21 07:42AM -0400 > The call with 6 arguments has used the first 6 of the 7 definition > but dropped the last argument (integer). > So will it just zero for the missing argument? Look at the declaration of the function with 7 arguments. Most likely it has a default value for the 7th one. The compiler will not supply any value unless it's specified. V -- I do not respond to top-posted replies, please don't ask |
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:
Post a Comment