Skip to content

Commit c1f8d06

Browse files
committed
Mark ctl::to_string() noexcept
1 parent e627bfa commit c1f8d06

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

ctl/string.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -426,31 +426,31 @@ static_assert(sizeof(__::small_string) == __::string_size);
426426
static_assert(sizeof(__::big_string) == __::string_size);
427427

428428
ctl::string
429-
to_string(int);
429+
to_string(int) noexcept;
430430

431431
ctl::string
432-
to_string(long);
432+
to_string(long) noexcept;
433433

434434
ctl::string
435-
to_string(long long);
435+
to_string(long long) noexcept;
436436

437437
ctl::string
438-
to_string(unsigned);
438+
to_string(unsigned) noexcept;
439439

440440
ctl::string
441-
to_string(unsigned long);
441+
to_string(unsigned long) noexcept;
442442

443443
ctl::string
444-
to_string(unsigned long long);
444+
to_string(unsigned long long) noexcept;
445445

446446
ctl::string
447-
to_string(float);
447+
to_string(float) noexcept;
448448

449449
ctl::string
450-
to_string(double);
450+
to_string(double) noexcept;
451451

452452
ctl::string
453-
to_string(long double);
453+
to_string(long double) noexcept;
454454

455455
} // namespace ctl
456456

ctl/to_string.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,49 +27,49 @@ namespace ctl {
2727
extern const double_conversion::DoubleToStringConverter kDoubleToPrintfG;
2828

2929
string
30-
to_string(int value)
30+
to_string(int value) noexcept
3131
{
3232
char buf[12];
3333
return { buf, FormatInt32(buf, value) - buf };
3434
}
3535

3636
string
37-
to_string(unsigned value)
37+
to_string(unsigned value) noexcept
3838
{
3939
char buf[12];
4040
return { buf, FormatUint32(buf, value) - buf };
4141
}
4242

4343
string
44-
to_string(long value)
44+
to_string(long value) noexcept
4545
{
4646
char buf[21];
4747
return { buf, FormatInt64(buf, value) - buf };
4848
}
4949

5050
string
51-
to_string(unsigned long value)
51+
to_string(unsigned long value) noexcept
5252
{
5353
char buf[21];
5454
return { buf, FormatUint64(buf, value) - buf };
5555
}
5656

5757
string
58-
to_string(long long value)
58+
to_string(long long value) noexcept
5959
{
6060
char buf[21];
6161
return { buf, FormatInt64(buf, value) - buf };
6262
}
6363

6464
string
65-
to_string(unsigned long long value)
65+
to_string(unsigned long long value) noexcept
6666
{
6767
char buf[21];
6868
return { buf, FormatUint64(buf, value) - buf };
6969
}
7070

7171
string
72-
to_string(float value)
72+
to_string(float value) noexcept
7373
{
7474
char buf[128];
7575
double_conversion::StringBuilder b(buf, sizeof(buf));
@@ -79,7 +79,7 @@ to_string(float value)
7979
}
8080

8181
string
82-
to_string(double value)
82+
to_string(double value) noexcept
8383
{
8484
char buf[128];
8585
double_conversion::StringBuilder b(buf, sizeof(buf));
@@ -89,7 +89,7 @@ to_string(double value)
8989
}
9090

9191
string
92-
to_string(long double value)
92+
to_string(long double value) noexcept
9393
{
9494
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
9595
return to_string((double)value);

test/ctl/to_string_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// PERFORMANCE OF THIS SOFTWARE.
1818

1919
#include "ctl/string.h"
20-
#include "libc/intrin/kprintf.h"
2120
#include "libc/limits.h"
2221
#include "libc/math.h"
2322
#include "libc/mem/leaks.h"

0 commit comments

Comments
 (0)