Displaying 20 results from an estimated 27 matches for "format_string".
2016 Oct 12
15
RFC: General purpose type-safe formatting library
...been working on a library that will solve all of these problems and
more.
The high level design of my library is borrowed heavily from C#. But if
you're not familiar with C#, I believe boost has something similar in
spirit. The best way to show it off is with some examples:
1. os << format_string("Test"); // writes "test"
2. os << format_string("{0}", 7); // writes "7"
Immediately we can see one big difference between this and llvm::format() /
printf. You don't have to specify the type. If you pass in an int, it
formats it as an int....
2016 Oct 12
2
RFC: General purpose type-safe formatting library
>> 1. os << format_string("Test"); // writes "test"
>> 2. os << format_string("{0}", 7); // writes "7"
>
>
> The "<< format_string(..." is ... really verbose for me. It also makes me
> strongly feel like this produces a string rather than a s...
2016 Oct 12
2
RFC: General purpose type-safe formatting library
...not sure that would work well. The implementation relies on being able
> to index into the parameter pack. How would you do that if each parameter
> is streamed in?
>
> "{0} {1}"_fs(1, 2)
>
> Could perhaps work, but it looks a little strange to me.
>
> Fwiw i agree format_string is long. Ideally it would be called format, but
> that's taken.
>
> Another option is os.format("{0}", 7), and have format_string("{0}", 7)
> return a std::string.
> On Wed, Oct 12, 2016 at 6:43 AM Aaron Ballman <aaron at aaronballman.com>
> wrote:
&g...
2016 Oct 12
2
RFC: General purpose type-safe formatting library
...as mentioning that we should do it :)
>
>
>
> The high level design of my library is borrowed heavily from C#. But if
> you're not familiar with C#, I believe boost has something similar in
> spirit. The best way to show it off is with some examples:
>
> 1. os << format_string("Test"); // writes "test"
> 2. os << format_string("{0}", 7); // writes "7"
>
> Immediately we can see one big difference between this and llvm::format()
> / printf. You don't have to specify the type. If you pass in an int, it
>...
2016 Oct 12
2
RFC: General purpose type-safe formatting library
...not sure that would work well. The implementation relies on being able
> to index into the parameter pack. How would you do that if each parameter
> is streamed in?
>
> "{0} {1}"_fs(1, 2)
>
> Could perhaps work, but it looks a little strange to me.
>
> Fwiw i agree format_string is long. Ideally it would be called format, but
> that's taken.
>
> Another option is os.format("{0}", 7), and have format_string("{0}", 7)
> return a std::string.
> On Wed, Oct 12, 2016 at 6:43 AM Aaron Ballman <aaron at aaronballman.com>
> wrote:
&g...
2016 Oct 12
3
RFC: General purpose type-safe formatting library
...not sure that would work well. The implementation relies on being able
> to index into the parameter pack. How would you do that if each parameter
> is streamed in?
>
> "{0} {1}"_fs(1, 2)
>
> Could perhaps work, but it looks a little strange to me.
>
> Fwiw i agree format_string is long. Ideally it would be called format, but
> that's taken.
>
> Another option is os.format("{0}", 7), and have format_string("{0}", 7)
> return a std::string.
> On Wed, Oct 12, 2016 at 6:43 AM Aaron Ballman <aaron at aaronballman.com>
> wrote:
&g...
2016 Nov 01
1
RFC: General purpose type-safe formatting library
...ly* prefer that this is accomplished with "normal" C++
> syntax, and that compile time checking is done with constexpr when
> available. I think that will give the overwhelming majority of the benefit
> with dramatically lower cost.
>
+1, the UDL seems a bit too automagical.
`format_string("{0}", 1)` is not that much longer than
`"{0}"_fmt.string(1)`, but significantly less magical.
Simple example: what should I type into a search engine to find the LLVM
doxygen for the UDL? I know to search "llvm format_string" for the format
string, but just from look...
2016 Nov 02
4
RFC: General purpose type-safe formatting library
* UDL Syntax is removed in the latest version of the patch
<https://reviews.llvm.org/D25587>.
* Name changed to `formatv` since `format_string` is too much to type.
* Added conversion operators for `std::string` and `llvm::SmallString`.
I had some feedback offline (not on this thread, unfortunately) that it
might be worth using a printf style syntax instead of this Python-esque
syntax. FTR, I actually somewhat object to this, for a coup...
2016 Oct 12
5
RFC: General purpose type-safe formatting library
...not sure that would work well. The implementation relies on being able
> to index into the parameter pack. How would you do that if each parameter
> is streamed in?
>
> "{0} {1}"_fs(1, 2)
>
> Could perhaps work, but it looks a little strange to me.
>
> Fwiw i agree format_string is long. Ideally it would be called format, but
> that's taken.
>
> Another option is os.format("{0}", 7), and have format_string("{0}", 7)
> return a std::string.
> On Wed, Oct 12, 2016 at 6:43 AM Aaron Ballman <aaron at aaronballman.com>
> wrote:
&g...
2006 Jan 05
2
how to use a helper which is not inside app/helpers/
Hi,
I wish to know it is possible to use a helper which is
not inside the folder ''app/helpers'', if it is
possbile, what should I do?
Thanks you very much!!!!
Saiho
__________________________________________
Yahoo! DSL ? Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
2016 Nov 01
4
RFC: General purpose type-safe formatting library
On Mon, Oct 31, 2016 at 3:46 PM Zachary Turner via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> Hi all,
>
> Tentatively final version is up here: https://reviews.llvm.org/D25587
>
> It has a verbal LGTM, but I plan to wait a bit longer just in case anyone
> has some additional thoughts. It's a large patch, but if you're
> interested, one way you can help
2016 Oct 12
2
RFC: General purpose type-safe formatting library
...g model. It's a wrapper around
snprintf, so you get what snprintf gives you. You can go *around*
llvm::format() and overload an operator to print your
std::chrono::time_point, but there's no way to integrate it into
llvm::format. So with my proposed library you could write:
os << format_string("Start: {0}, End: {1}, Elapsed: {2:ms}", start, end,
start-end);
Or you could write:
os << "Start: " << format_time_point(start) << ", End: "
<< format_time_point(end) << ", Elapsed: " <<
std::chrono::duration_cast<std...
2006 Apr 24
3
TimeStamp conversion
Hi,
I''ve got a TimeStamp field in MySql and want to use the hour and minutes
in the value.
for example:
StartTime = Schedule.find(action2.ScheduleID).DateTimeStart.to_s
That returns "Mon Feb 20 08:00:00 Romance Standard Time 2006"
How do I get 08:00 returned ??
Thanks !
Steven.
--
Posted via http://www.ruby-forum.com/.
2003 Jul 15
2
printf and friends in R?
Hi folks
Does R have anything straightforwardly resembling the commands
fprintf, sprintf, printf (derived from C, and present in octave
and matlab)?
As in printf(format_string, ... )
where "format_string" defines the print format (including any
fixed text) and "..." is a list of variables whose values are
to be inserted into the line.
Example:
printf("Case %d#%.2f#%.2f%.4f\n", n,x1,x2,x3 )
which would output a line like
Case 10#3.21#...
2020 Apr 25
2
[PATCH 1/3] Add private key protection information extraction to ssh-keygen
Add private key protection information extraction to shh-keygen using -v
option on top of -y option which is already parsing the private key.
Technically, the passphrase isn't necessary to do this, but it is the
most logical thing to do for me.
Adding this to -l option is not appropriate because fingerprinting is
using the .pub file when available.
An other idea is to add a new option, I
2005 Dec 19
8
Simply Ruby question: "zerofill"
Hi there-
What''s the easiest/most efficient way to perform a zerofill in Ruby?
i.e. Given the value ''val'', I would like to do something like:
val = 43
puts val.zerofill(8)
---> "00000043"
gsub? sprintf of some sort?
Jake
--
Posted via http://www.ruby-forum.com/.
2016 Oct 13
2
RFC: General purpose type-safe formatting library
AFAICT this appears to be the first time you've clarified that you're
talking about a situation where the compile-time checking happens using
something other than format strings. In Pavel's original email, he
suggested compile time checking and you mentioned that I didn't object to
it. But if you go back and read my response, I said we can do the compile
time checking *of the
2012 Apr 20
1
[PATCH] multiqueue: a hodge podge of things
...(void)
{
transport_class_unregister(&fc_transport_class);
transport_class_unregister(&fc_rport_class);
transport_class_unregister(&fc_host_class);
transport_class_unregister(&fc_vport_class);
}
/*
* FC Remote Port Attribute Management
*/
#define fc_rport_show_function(field, format_string, sz, cast) \
static ssize_t \
show_fc_rport_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct fc_rport *rport = transport_class_to_rport(dev); \
struct Scsi_Host *shost = rport_to_shost(rport); \
struct fc_internal *i = to_fc_int...
2012 Apr 20
1
[PATCH] multiqueue: a hodge podge of things
...(void)
{
transport_class_unregister(&fc_transport_class);
transport_class_unregister(&fc_rport_class);
transport_class_unregister(&fc_host_class);
transport_class_unregister(&fc_vport_class);
}
/*
* FC Remote Port Attribute Management
*/
#define fc_rport_show_function(field, format_string, sz, cast) \
static ssize_t \
show_fc_rport_##field (struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct fc_rport *rport = transport_class_to_rport(dev); \
struct Scsi_Host *shost = rport_to_shost(rport); \
struct fc_internal *i = to_fc_int...
2007 Jun 22
0
Re: Intermittent "INTERNAL ERROR: Signal 11" with 3.0.24
Hi all
Follow up to this post, we've been able to capture a gdb
backtrace. Can anyone help with guidance as to what this
means. See below:
(gdb) bt
#0 0xffffe410 in ?? ()
#1 0x00000001 in ?? ()
#2 0x00000000 in ?? ()
#3 0xbfffc9d8 in ?? ()
#4 0x402b36e3 in __waitpid_nocancel () from
/lib/tls/libc.so.6
#5 0x4025ef58 in do_system () from /lib/tls/libc.so.6
#6 0x402268dd in system ()