From 8b9abf740a41e8feb7db7638ce27f7cecc16d633 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Mon, 2 Nov 2020 12:10:37 -0700 Subject: add opaque struct --- language/type-definition.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)? -- cgit v1.2.3