Skip to content

Commit 15b1b30

Browse files
authored
Remove void in zero-parameter functions (#63)
The isocpp FAQ recommends against this practice.
1 parent b322451 commit 15b1b30

File tree

6 files changed

+60
-60
lines changed

6 files changed

+60
-60
lines changed

src/FixedPoints/Details.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace FIXED_POINTS_DETAILS
4343
template< typename T >
4444
struct BitSize
4545
{
46-
BitSize(void) = delete;
46+
BitSize() = delete;
4747
constexpr static const auto Value = sizeof(T) * CHAR_BIT;
4848
};
4949

@@ -77,14 +77,14 @@ namespace FIXED_POINTS_DETAILS
7777
template< unsigned Bits, typename T, typename... Ts >
7878
struct LeastTypeHelper<Bits, T, Ts... >
7979
{
80-
LeastTypeHelper(void) = delete;
80+
LeastTypeHelper() = delete;
8181
using Type = ConditionalT<(Bits <= BitSize<T>::Value), T, typename LeastTypeHelper<Bits, Ts...>::Type>;
8282
};
8383

8484
template< unsigned Bits >
8585
struct LeastTypeHelper<Bits>
8686
{
87-
LeastTypeHelper(void) = delete;
87+
LeastTypeHelper() = delete;
8888
using Type = void;
8989
};
9090

@@ -96,7 +96,7 @@ namespace FIXED_POINTS_DETAILS
9696
struct LeastUIntDef
9797
{
9898
static_assert(Bits <= BitSize<uintmax_t>::Value, "No type large enough");
99-
LeastUIntDef(void) = delete;
99+
LeastUIntDef() = delete;
100100
using Type = LeastType<Bits, uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t, uintmax_t>;
101101
};
102102

@@ -108,7 +108,7 @@ namespace FIXED_POINTS_DETAILS
108108
struct LeastIntDef
109109
{
110110
static_assert(Bits <= BitSize<intmax_t>::Value, "No type large enough");
111-
LeastIntDef(void) = delete;
111+
LeastIntDef() = delete;
112112
using Type = LeastType<Bits, int_least8_t, int_least16_t, int_least32_t, int_least64_t, intmax_t>;
113113
};
114114

@@ -118,21 +118,21 @@ namespace FIXED_POINTS_DETAILS
118118
template< unsigned Bits >
119119
struct MsbMask
120120
{
121-
MsbMask(void) = delete;
121+
MsbMask() = delete;
122122
constexpr const static LeastUInt<Bits> Value = (1ull << (Bits - 1));
123123
};
124124

125125
template< unsigned Bits >
126126
struct IdentityMask
127127
{
128-
IdentityMask(void) = delete;
128+
IdentityMask() = delete;
129129
constexpr const static LeastUInt<Bits> Value = 1 | (IdentityMask<Bits - 1>::Value << 1);
130130
};
131131

132132
template<>
133133
struct IdentityMask<0>
134134
{
135-
IdentityMask(void) = delete;
135+
IdentityMask() = delete;
136136
constexpr const static LeastUInt<0> Value = 0;
137137
};
138138

src/FixedPoints/SFixed.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class SFixed
6464

6565
public:
6666
constexpr inline explicit RawType(const InternalType & value) : value(value) {}
67-
constexpr inline explicit operator InternalType(void) const { return this->value; }
67+
constexpr inline explicit operator InternalType() const { return this->value; }
6868
};
6969

7070
protected:
@@ -74,7 +74,7 @@ class SFixed
7474
constexpr SFixed(const RawType & value);
7575

7676
public:
77-
constexpr SFixed(void);
77+
constexpr SFixed();
7878
constexpr SFixed(const IntegerType & integer, const FractionType & fraction);
7979
constexpr SFixed(const char & value);
8080
constexpr SFixed(const unsigned char & value);
@@ -91,23 +91,23 @@ class SFixed
9191
constexpr SFixed(const float & value);
9292
constexpr SFixed(const long double & value);
9393

94-
constexpr InternalType getInternal(void) const;
95-
constexpr IntegerType getInteger(void) const;
96-
constexpr FractionType getFraction(void) const;
94+
constexpr InternalType getInternal() const;
95+
constexpr IntegerType getInteger() const;
96+
constexpr FractionType getFraction() const;
9797

98-
constexpr explicit operator IntegerType(void) const;
99-
constexpr explicit operator float(void) const;
100-
constexpr explicit operator double(void) const;
101-
constexpr explicit operator long double(void) const;
98+
constexpr explicit operator IntegerType() const;
99+
constexpr explicit operator float() const;
100+
constexpr explicit operator double() const;
101+
constexpr explicit operator long double() const;
102102

103103
template< unsigned IntegerOut, unsigned FractionOut >
104-
constexpr explicit operator SFixed<IntegerOut, FractionOut>(void) const;
104+
constexpr explicit operator SFixed<IntegerOut, FractionOut>() const;
105105

106106
constexpr static SFixed fromInternal(const InternalType & value);
107107

108-
constexpr SFixed operator -(void) const;
109-
SFixed & operator ++(void);
110-
SFixed & operator --(void);
108+
constexpr SFixed operator -() const;
109+
SFixed & operator ++();
110+
SFixed & operator --();
111111
SFixed & operator +=(const SFixed & other);
112112
SFixed & operator -=(const SFixed & other);
113113
SFixed & operator *=(const SFixed & other);

src/FixedPoints/SFixedMemberFunctions.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ constexpr SFixed<Integer, Fraction>::SFixed(const RawType & value)
2525
}
2626

2727
template< unsigned Integer, unsigned Fraction >
28-
constexpr SFixed<Integer, Fraction>::SFixed(void)
28+
constexpr SFixed<Integer, Fraction>::SFixed()
2929
: value(0)
3030
{
3131
}
@@ -125,19 +125,19 @@ constexpr SFixed<Integer, Fraction>::SFixed(const long double & value)
125125
//
126126

127127
template< unsigned Integer, unsigned Fraction >
128-
constexpr typename SFixed<Integer, Fraction>::InternalType SFixed<Integer, Fraction>::getInternal(void) const
128+
constexpr typename SFixed<Integer, Fraction>::InternalType SFixed<Integer, Fraction>::getInternal() const
129129
{
130130
return this->value;
131131
}
132132

133133
template< unsigned Integer, unsigned Fraction >
134-
constexpr typename SFixed<Integer, Fraction>::IntegerType SFixed<Integer, Fraction>::getInteger(void) const
134+
constexpr typename SFixed<Integer, Fraction>::IntegerType SFixed<Integer, Fraction>::getInteger() const
135135
{
136136
return (static_cast<IntegerType>(this->value >> IntegerShift) & IntegerMask) | ((this->value < 0) ? ~IntegerMask : 0);
137137
}
138138

139139
template< unsigned Integer, unsigned Fraction >
140-
constexpr typename SFixed<Integer, Fraction>::FractionType SFixed<Integer, Fraction>::getFraction(void) const
140+
constexpr typename SFixed<Integer, Fraction>::FractionType SFixed<Integer, Fraction>::getFraction() const
141141
{
142142
return static_cast<FractionType>(this->value >> FractionShift) & FractionMask;
143143
}
@@ -147,13 +147,13 @@ constexpr typename SFixed<Integer, Fraction>::FractionType SFixed<Integer, Fract
147147
//
148148

149149
template< unsigned Integer, unsigned Fraction >
150-
constexpr SFixed<Integer, Fraction>::operator IntegerType(void) const
150+
constexpr SFixed<Integer, Fraction>::operator IntegerType() const
151151
{
152152
return this->getInteger();
153153
}
154154

155155
template< unsigned Integer, unsigned Fraction >
156-
constexpr SFixed<Integer, Fraction>::operator float(void) const
156+
constexpr SFixed<Integer, Fraction>::operator float() const
157157
{
158158
return (1.0F / Scale) *
159159
static_cast<InternalType>
@@ -162,7 +162,7 @@ constexpr SFixed<Integer, Fraction>::operator float(void) const
162162
}
163163

164164
template< unsigned Integer, unsigned Fraction >
165-
constexpr SFixed<Integer, Fraction>::operator double(void) const
165+
constexpr SFixed<Integer, Fraction>::operator double() const
166166
{
167167
return (1.0 / Scale) *
168168
static_cast<InternalType>
@@ -171,7 +171,7 @@ constexpr SFixed<Integer, Fraction>::operator double(void) const
171171
}
172172

173173
template< unsigned Integer, unsigned Fraction >
174-
constexpr SFixed<Integer, Fraction>::operator long double(void) const
174+
constexpr SFixed<Integer, Fraction>::operator long double() const
175175
{
176176
return (1.0L / Scale) *
177177
static_cast<InternalType>
@@ -181,7 +181,7 @@ constexpr SFixed<Integer, Fraction>::operator long double(void) const
181181

182182
template< unsigned Integer, unsigned Fraction >
183183
template< unsigned IntegerOut, unsigned FractionOut >
184-
constexpr SFixed<Integer, Fraction>::operator SFixed<IntegerOut, FractionOut>(void) const
184+
constexpr SFixed<Integer, Fraction>::operator SFixed<IntegerOut, FractionOut>() const
185185
{
186186
using OutputType = SFixed<IntegerOut, FractionOut>;
187187
using OutputInternalType = typename OutputType::InternalType;
@@ -209,7 +209,7 @@ constexpr SFixed<Integer, Fraction> SFixed<Integer, Fraction>::fromInternal(cons
209209
}
210210

211211
template< unsigned Integer, unsigned Fraction >
212-
constexpr SFixed<Integer, Fraction> SFixed<Integer, Fraction>::operator -(void) const
212+
constexpr SFixed<Integer, Fraction> SFixed<Integer, Fraction>::operator -() const
213213
{
214214
return SFixed<Integer, Fraction>::fromInternal(-this->value);
215215
}
@@ -219,14 +219,14 @@ constexpr SFixed<Integer, Fraction> SFixed<Integer, Fraction>::operator -(void)
219219
//
220220

221221
template< unsigned Integer, unsigned Fraction >
222-
SFixed<Integer, Fraction> & SFixed<Integer, Fraction>::operator ++(void)
222+
SFixed<Integer, Fraction> & SFixed<Integer, Fraction>::operator ++()
223223
{
224224
this->value += (1 << FractionSize);
225225
return *this;
226226
}
227227

228228
template< unsigned Integer, unsigned Fraction >
229-
SFixed<Integer, Fraction> & SFixed<Integer, Fraction>::operator --(void)
229+
SFixed<Integer, Fraction> & SFixed<Integer, Fraction>::operator --()
230230
{
231231
this->value -= (1 << FractionSize);
232232
return *this;

src/FixedPoints/UFixed.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class UFixed
6464

6565
public:
6666
constexpr inline explicit RawType(const InternalType & value) : value(value) {}
67-
constexpr inline explicit operator InternalType(void) const { return this->value; }
67+
constexpr inline explicit operator InternalType() const { return this->value; }
6868
};
6969

7070
protected:
@@ -74,7 +74,7 @@ class UFixed
7474
constexpr UFixed(const RawType & value);
7575

7676
public:
77-
constexpr UFixed(void);
77+
constexpr UFixed();
7878
constexpr UFixed(const IntegerType & integer, const FractionType & fraction);
7979
constexpr UFixed(const char & value);
8080
constexpr UFixed(const unsigned char & value);
@@ -92,22 +92,22 @@ class UFixed
9292
constexpr UFixed(const long double & value);
9393

9494
public:
95-
constexpr InternalType getInternal(void) const;
96-
constexpr IntegerType getInteger(void) const;
97-
constexpr FractionType getFraction(void) const;
95+
constexpr InternalType getInternal() const;
96+
constexpr IntegerType getInteger() const;
97+
constexpr FractionType getFraction() const;
9898

99-
constexpr explicit operator IntegerType(void) const;
100-
constexpr explicit operator float(void) const;
101-
constexpr explicit operator double(void) const;
102-
constexpr explicit operator long double(void) const;
99+
constexpr explicit operator IntegerType() const;
100+
constexpr explicit operator float() const;
101+
constexpr explicit operator double() const;
102+
constexpr explicit operator long double() const;
103103

104104
template< unsigned IntegerOut, unsigned FractionOut >
105-
constexpr explicit operator UFixed<IntegerOut, FractionOut>(void) const;
105+
constexpr explicit operator UFixed<IntegerOut, FractionOut>() const;
106106

107107
constexpr static UFixed fromInternal(const InternalType & value);
108108

109-
UFixed & operator ++(void);
110-
UFixed & operator --(void);
109+
UFixed & operator ++();
110+
UFixed & operator --();
111111
UFixed & operator +=(const UFixed & other);
112112
UFixed & operator -=(const UFixed & other);
113113
UFixed & operator *=(const UFixed & other);

src/FixedPoints/UFixedMemberFunctions.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ constexpr UFixed<Integer, Fraction>::UFixed(const RawType & value)
2525
}
2626

2727
template< unsigned Integer, unsigned Fraction >
28-
constexpr UFixed<Integer, Fraction>::UFixed(void)
28+
constexpr UFixed<Integer, Fraction>::UFixed()
2929
: value(0)
3030
{
3131
}
@@ -125,19 +125,19 @@ constexpr UFixed<Integer, Fraction>::UFixed(const long double & value)
125125
//
126126

127127
template< unsigned Integer, unsigned Fraction >
128-
constexpr typename UFixed<Integer, Fraction>::InternalType UFixed<Integer, Fraction>::getInternal(void) const
128+
constexpr typename UFixed<Integer, Fraction>::InternalType UFixed<Integer, Fraction>::getInternal() const
129129
{
130130
return this->value;
131131
}
132132

133133
template< unsigned Integer, unsigned Fraction >
134-
constexpr typename UFixed<Integer, Fraction>::IntegerType UFixed<Integer, Fraction>::getInteger(void) const
134+
constexpr typename UFixed<Integer, Fraction>::IntegerType UFixed<Integer, Fraction>::getInteger() const
135135
{
136136
return static_cast<IntegerType>(this->value >> IntegerShift) & IntegerMask;
137137
}
138138

139139
template< unsigned Integer, unsigned Fraction >
140-
constexpr typename UFixed<Integer, Fraction>::FractionType UFixed<Integer, Fraction>::getFraction(void) const
140+
constexpr typename UFixed<Integer, Fraction>::FractionType UFixed<Integer, Fraction>::getFraction() const
141141
{
142142
return static_cast<FractionType>(this->value >> FractionShift) & FractionMask;
143143
}
@@ -147,32 +147,32 @@ constexpr typename UFixed<Integer, Fraction>::FractionType UFixed<Integer, Fract
147147
//
148148

149149
template< unsigned Integer, unsigned Fraction >
150-
constexpr UFixed<Integer, Fraction>::operator IntegerType(void) const
150+
constexpr UFixed<Integer, Fraction>::operator IntegerType() const
151151
{
152152
return this->getInteger();
153153
}
154154

155155
template< unsigned Integer, unsigned Fraction >
156-
constexpr UFixed<Integer, Fraction>::operator float(void) const
156+
constexpr UFixed<Integer, Fraction>::operator float() const
157157
{
158158
return ((this->value & IdentityMask) * (1.0F / Scale));
159159
}
160160

161161
template< unsigned Integer, unsigned Fraction >
162-
constexpr UFixed<Integer, Fraction>::operator double(void) const
162+
constexpr UFixed<Integer, Fraction>::operator double() const
163163
{
164164
return ((this->value & IdentityMask) * (1.0 / Scale));
165165
}
166166

167167
template< unsigned Integer, unsigned Fraction >
168-
constexpr UFixed<Integer, Fraction>::operator long double(void) const
168+
constexpr UFixed<Integer, Fraction>::operator long double() const
169169
{
170170
return ((this->value & IdentityMask) * (1.0L / Scale));
171171
}
172172

173173
template< unsigned Integer, unsigned Fraction >
174174
template< unsigned IntegerOut, unsigned FractionOut >
175-
constexpr UFixed<Integer, Fraction>::operator UFixed<IntegerOut, FractionOut>(void) const
175+
constexpr UFixed<Integer, Fraction>::operator UFixed<IntegerOut, FractionOut>() const
176176
{
177177
using OutputType = UFixed<IntegerOut, FractionOut>;
178178
using OutputInternalType = typename OutputType::InternalType;
@@ -204,14 +204,14 @@ constexpr UFixed<Integer, Fraction> UFixed<Integer, Fraction>::fromInternal(cons
204204
//
205205

206206
template< unsigned Integer, unsigned Fraction >
207-
UFixed<Integer, Fraction> & UFixed<Integer, Fraction>::operator ++(void)
207+
UFixed<Integer, Fraction> & UFixed<Integer, Fraction>::operator ++()
208208
{
209209
this->value += (1 << FractionSize);
210210
return *this;
211211
}
212212

213213
template< unsigned Integer, unsigned Fraction >
214-
UFixed<Integer, Fraction> & UFixed<Integer, Fraction>::operator --(void)
214+
UFixed<Integer, Fraction> & UFixed<Integer, Fraction>::operator --()
215215
{
216216
this->value -= (1 << FractionSize);
217217
return *this;

src/FixedPoints/Utils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ constexpr UFixed<Integer, Fraction> nextafterFixed(const UFixed<Integer, Fractio
6363

6464
#if !defined(FIXED_POINTS_NO_RANDOM)
6565
template< unsigned Integer, unsigned Fraction >
66-
UFixed<Integer, Fraction> randomUFixed(void);
66+
UFixed<Integer, Fraction> randomUFixed();
6767

6868
template< unsigned Integer, unsigned Fraction >
6969
UFixed<Integer, Fraction> randomUFixed(const UFixed<Integer, Fraction> & exclusiveUpperBound);
@@ -78,7 +78,7 @@ UFixed<Integer, Fraction> randomUFixed(const UFixed<Integer, Fraction> & inclusi
7878

7979
#if !defined(FIXED_POINTS_NO_RANDOM)
8080
template< unsigned Integer, unsigned Fraction >
81-
SFixed<Integer, Fraction> randomSFixed(void);
81+
SFixed<Integer, Fraction> randomSFixed();
8282

8383
template< unsigned Integer, unsigned Fraction >
8484
SFixed<Integer, Fraction> randomSFixed(const SFixed<Integer, Fraction> & exclusiveUpperBound);
@@ -204,7 +204,7 @@ constexpr UFixed<Integer, Fraction> nextafterFixed(const UFixed<Integer, Fractio
204204

205205
#if !defined(FIXED_POINTS_NO_RANDOM)
206206
template< unsigned Integer, unsigned Fraction >
207-
UFixed<Integer, Fraction> randomUFixed(void)
207+
UFixed<Integer, Fraction> randomUFixed()
208208
{
209209
using InternalType = typename UFixed<Integer, Fraction>::InternalType;
210210
return UFixed<Integer, Fraction>::fromInternal(FIXED_POINTS_DETAILS::RandomHelper<InternalType>::Random());
@@ -231,7 +231,7 @@ UFixed<Integer, Fraction> randomUFixed(const UFixed<Integer, Fraction> & inclusi
231231

232232
#if !defined(FIXED_POINTS_NO_RANDOM)
233233
template< unsigned Integer, unsigned Fraction >
234-
SFixed<Integer, Fraction> randomSFixed(void)
234+
SFixed<Integer, Fraction> randomSFixed()
235235
{
236236
using InternalType = typename SFixed<Integer, Fraction>::InternalType;
237237
return SFixed<Integer, Fraction>::fromInternal(FIXED_POINTS_DETAILS::RandomHelper<InternalType>::Random());

0 commit comments

Comments
 (0)