Class: Rubycc::Type::VoidType
- Inherits:
-
Object
- Object
- Rubycc::Type::VoidType
- Defined in:
- lib/rubycc/type.rb
Overview
The incomplete void type. A single shared instance (Type::Void) stands
in for every void. It is valid only as a function's return type or as
the target of a pointer (void *); every other use (a variable, an
array element, a non-pointer parameter, sizeof(void), dereferencing a
void *) is rejected by the parser or the generator rather than modelled
here. It has no storage width: #size raises, since a well-formed program
never asks a bare void for one.
Instance Method Summary collapse
-
#alignment ⇒ Object
voidhas no alignment for the same reason it has no size; a well-formed program never lays a barevoidout in storage. - #arithmetic? ⇒ Boolean
- #array? ⇒ Boolean
- #bool? ⇒ Boolean
- #char? ⇒ Boolean
- #float? ⇒ Boolean
- #function? ⇒ Boolean
- #int? ⇒ Boolean
- #integer? ⇒ Boolean
- #pointer? ⇒ Boolean
-
#size ⇒ Object
voidis incomplete and has no storage width; every call site that might reach a barevoidhere (sizeof, a global's layout, ...) rejects it first with a proper CompileError, so reaching this is a bug. - #struct? ⇒ Boolean
- #to_s ⇒ Object
- #void? ⇒ Boolean
Instance Method Details
#alignment ⇒ Object
void has no alignment for the same reason it has no size; a
well-formed program never lays a bare void out in storage.
209 210 211 |
# File 'lib/rubycc/type.rb', line 209 def alignment raise "void has no alignment" end |
#arithmetic? ⇒ Boolean
176 177 178 |
# File 'lib/rubycc/type.rb', line 176 def arithmetic? false end |
#array? ⇒ Boolean
188 189 190 |
# File 'lib/rubycc/type.rb', line 188 def array? false end |
#bool? ⇒ Boolean
184 185 186 |
# File 'lib/rubycc/type.rb', line 184 def bool? false end |
#char? ⇒ Boolean
164 165 166 |
# File 'lib/rubycc/type.rb', line 164 def char? false end |
#float? ⇒ Boolean
180 181 182 |
# File 'lib/rubycc/type.rb', line 180 def float? false end |
#function? ⇒ Boolean
196 197 198 |
# File 'lib/rubycc/type.rb', line 196 def function? false end |
#int? ⇒ Boolean
160 161 162 |
# File 'lib/rubycc/type.rb', line 160 def int? false end |
#integer? ⇒ Boolean
172 173 174 |
# File 'lib/rubycc/type.rb', line 172 def integer? false end |
#pointer? ⇒ Boolean
156 157 158 |
# File 'lib/rubycc/type.rb', line 156 def pointer? false end |
#size ⇒ Object
void is incomplete and has no storage width; every call site that
might reach a bare void here (sizeof, a global's layout, ...) rejects
it first with a proper CompileError, so reaching this is a bug.
203 204 205 |
# File 'lib/rubycc/type.rb', line 203 def size raise "void has no size" end |
#struct? ⇒ Boolean
192 193 194 |
# File 'lib/rubycc/type.rb', line 192 def struct? false end |
#to_s ⇒ Object
213 214 215 |
# File 'lib/rubycc/type.rb', line 213 def to_s "void" end |
#void? ⇒ Boolean
168 169 170 |
# File 'lib/rubycc/type.rb', line 168 def void? true end |