diff options
author | Melody Horn <melody@boringcactus.com> | 2020-11-02 12:10:37 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2020-11-02 12:10:37 -0700 |
commit | 8b9abf740a41e8feb7db7638ce27f7cecc16d633 (patch) | |
tree | bcb5a391da9eb0b21da31932628e5184f498db6c | |
parent | 26ebe332ecb1c274a073ae3f0537e8557f66e5f2 (diff) | |
download | spec-8b9abf740a41e8feb7db7638ce27f7cecc16d633.tar.gz spec-8b9abf740a41e8feb7db7638ce27f7cecc16d633.zip |
add opaque struct
-rw-r--r-- | language/type-definition.rst | 8 |
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)? |