mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2015-09-22, 14:49   #1
Explorer09
 
May 2014

418 Posts
Default (patch) No need for fmt_mask[] buffer

This patch is for Prime95 v28.7

The printf and sprintf functions in C library support '*' as precision. Therefore there is no need for the 'masked' format string like "%%.%df%%%%" and a buffer to store the temporary format string ("%.2f%%"). Just use syntax like printf("%.*f%%", precision, number); .

This patch removes the use of fmt_mask[] and 'masked' format strings.

Technically the '*' specifier for width or precision in printf takes an 'int' argument, but the global PRECISION variable expects only an integer within the interval [0,6]. It is good to keep it an 'unsigned int' to save a "if (PRECISION<0)" check code.
Attached Files
File Type: txt mprime-no-fmt-mask.patch.txt (13.4 KB, 106 views)
Explorer09 is offline   Reply With Quote
Old 2015-09-22, 14:57   #2
ramshanker
 
ramshanker's Avatar
 
"Ram Shanker"
May 2015
Delhi

2·19 Posts
Talking

This kind of patches over this forum along with respective files really makes me wonder whether we should move to github for version control and much wider participation from coder community.

All the cool kids projects are on GitHub these days.
ramshanker is offline   Reply With Quote
Old 2015-09-22, 15:21   #3
Madpoo
Serpentine Vermin Jar
 
Madpoo's Avatar
 
Jul 2014

31×107 Posts
Default

Quote:
Originally Posted by ramshanker View Post
This kind of patches over this forum along with respective files really makes me wonder whether we should move to github for version control and much wider participation from coder community.

All the cool kids projects are on GitHub these days.
It would be nice to see that, at the very least to be able to see what changes were actually made between versions without loading both up and using a comparison tool.

I'd guess most/all of the changes are still done by George so it would really depend on whether he was up for a move like that, but a shared repository like Github or whatever else sure seems like a good direction to go.
Madpoo is offline   Reply With Quote
Old 2015-09-22, 17:11   #4
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

23·7·137 Posts
Default

Quote:
Originally Posted by ramshanker View Post
All the cool kids projects are on GitHub these days.
I guess I'm from the old fart school of programming.

Seriously, I use an svn repository. Can such a thing be migrated to github? There are a lot of history comments I wouldn't want to lose. Also, I've grown accustomed to svnX and its diff tools.

Last fiddled with by Prime95 on 2015-09-22 at 17:15
Prime95 is online now   Reply With Quote
Old 2015-09-22, 21:01   #5
ewmayer
2ω=0
 
ewmayer's Avatar
 
Sep 2002
República de California

266318 Posts
Default

@Github pumpers:

Quote:
Originally Posted by Prime95 View Post
I guess I'm from the old fart school of programming.

Seriously, I use an svn repository. Can such a thing be migrated to github? There are a lot of history comments I wouldn't want to lose. Also, I've grown accustomed to svnX and its diff tools.
Plus, if Sourceforge and its "suck 'em in with the 'cool kidzz' aspect, then a few years later sell out big-time and start using project space for selling ads" business model is any guide, Github being 'cool' today says nada about 5,10,20 years from now. Look at the date on George's program and tell me - how many Sourceforge/Github-style sites have [a] been around that long and [b] remained true to the shareware-project-support-rather-than-blatant-rent-extraction model?

The only way to be sure of one's infrastructure over the long haul here is to pick clear open-source winners with broad community support early on and be very wary of trading 'convenience today' for nightmares down the road. Visual Studio is a prime example of the latter tradeoff.

To put in plan-of-battle terms: Keep it simple as reasonably possible and remain focused on the mission.

Last fiddled with by ewmayer on 2015-09-22 at 21:03
ewmayer is offline   Reply With Quote
Old 2015-09-22, 22:42   #6
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

1DF816 Posts
Default

Quote:
Originally Posted by Explorer09 View Post
This patch is for Prime95 v28.7
Thanks. This is much cleaner.
Prime95 is online now   Reply With Quote
Old 2015-09-22, 23:55   #7
Explorer09
 
May 2014

3×11 Posts
Default

Speaking of SVN, you should probably ignore ".DS_Store" files from versioning, or at least not include them in your source zip package.

Or is there any reason to keep them?
Explorer09 is offline   Reply With Quote
Old 2015-09-23, 00:15   #8
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013

B6B16 Posts
Default

Quote:
Originally Posted by ewmayer View Post
Plus, if Sourceforge and its "suck 'em in with the 'cool kidzz' aspect, then a few years later sell out big-time and start using project space for selling ads" business model is any guide, Github being 'cool' today says nada about 5,10,20 years from now. Look at the date on George's program and tell me - how many Sourceforge/Github-style sites have [a] been around that long and [b] remained true to the shareware-project-support-rather-than-blatant-rent-extraction model?
I think GitHub will be in business for a while. We spend $100 a month with them. We're just one company.

But as you know there is no one repository with git, so mirroring it on other services like GitLab/Gitorious is trivial.
Mark Rose is offline   Reply With Quote
Old 2015-09-23, 08:37   #9
blip
 
blip's Avatar
 
Jan 2014

14610 Posts
Default

Quote:
Originally Posted by Prime95 View Post
I guess I'm from the old fart school of programming.

Seriously, I use an svn repository. Can such a thing be migrated to github? There are a lot of history comments I wouldn't want to lose. Also, I've grown accustomed to svnX and its diff tools.

You can work it out locally to get started. Have a look at https://git-scm.com/book/it/v2/Git-a...grating-to-Git

We migrated all our projects (100+) form svn to git without any issues. If you then use github or bitbucket (or any other provider) depends on your trust in their policies. We use both, depending on the project.
blip is offline   Reply With Quote
Old 2015-09-23, 14:56   #10
ramshanker
 
ramshanker's Avatar
 
"Ram Shanker"
May 2015
Delhi

2×19 Posts
Smile

Quote:
Originally Posted by Prime95 View Post
I guess I'm from the old fart school of programming.
I didn't mean to undermine your efforts in any way.

I am just starting up with all this factoring mania! Still at O(grade school). Long way to go till O(n log n). Tried searching for the Assembly code once in Prime95 code base, and was surprised not to find it on GitHub.
ramshanker is offline   Reply With Quote
Old 2015-09-23, 18:59   #11
TObject
 
TObject's Avatar
 
Feb 2012

6258 Posts
Thumbs up

As other posters touched on the subject a little bit, a great differentiator of Git (and other systems like it) is that it is a distributed source control system. It does not need a central server. Each cloned repository is self-contained, and can be used to make further clones. As such, you are not ‘tied forever’ to any particular server; if GitHub goes down, for example, you can take your local repository, and load it on some other service.

Another point I want to make is that Git is not synonymous to GitHub. GitHub is the biggest provider, but you do not have to use it. There are other providers; Microsoft Visual Studio Online, for example, supports Git, and it is free for up to five users. Also, if you choose so, it should not be too difficult to add your own Git server software to the mersenne.org, so you do not have to rely on third parties for distributing repositories.
TObject is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Patch) Handling of SIGHUP and SIGPIPE (for mprime) Explorer09 Software 2 2017-03-08 05:37
[Patch] Fix strcpy misuse in getProxyInfo() Explorer09 Software 1 2017-03-01 22:03
(patch) IniWriteFloat should limit its field width Explorer09 Software 0 2015-09-23 01:02
v1.40 patch for massive NFS oversieving jasonp Msieve 18 2009-04-09 03:20
Amd patch moo Hardware 6 2005-10-10 23:29

All times are UTC. The time now is 11:03.


Sun Nov 28 11:03:20 UTC 2021 up 128 days, 5:32, 0 users, load averages: 1.23, 1.08, 1.07

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.