aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-11-02 12:10:37 -0700
committerMelody Horn <melody@boringcactus.com>2020-11-02 12:10:37 -0700
commit8b9abf740a41e8feb7db7638ce27f7cecc16d633 (patch)
treebcb5a391da9eb0b21da31932628e5184f498db6c
parent26ebe332ecb1c274a073ae3f0537e8557f66e5f2 (diff)
downloadspec-8b9abf740a41e8feb7db7638ce27f7cecc16d633.tar.gz
spec-8b9abf740a41e8feb7db7638ce27f7cecc16d633.zip
add opaque struct
-rw-r--r--language/type-definition.rst8
1 files changed, 7 insertions, 1 deletions
diff --git a/language/type-definition.rst b/language/type-definition.rst
index 327fb4d..b596d0a 100644
--- a/language/type-definition.rst
+++ b/language/type-definition.rst
@@ -5,7 +5,8 @@ Defining Types
Crowbar has three different kinds of user-defined types.
-.. crowbar:element:: StructDefinition <- 'struct' identifier '{' VariableDeclaration+ '}'
+.. crowbar:element:: StructDefinition <- NormalStructDefinition / OpaqueStructDefinition
+ NormalStructDefinition <- 'struct' identifier '{' VariableDeclaration+ '}'
A ``struct`` defines a composite type with several members.
@@ -13,6 +14,11 @@ Defining Types
define struct layout in memory
+.. crowbar:element:: OpaqueStructDefinition <- 'opaque' 'struct' identifier ';'
+
+ An *opaque struct* is a struct whose name is part of an API boundary but whose contents are not.
+ Its size is left unspecified, and it can only be used as the target of a pointer.
+
.. crowbar:element:: EnumDefinition <- 'enum' identifier '{' EnumMember (',' EnumMember)* ','? '}'
EnumMember <- identifier ('=' Expression)?