---
title: "CreateCompDescriptor(_:_:_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1449155-createcompdescriptor
---

# CreateCompDescriptor(_:_:_:_:_:)

Creates a comparison descriptor that specifies how to compare one or more Apple event objects with either another Apple event object or a descriptor.

## Declaration

```swift
func CreateCompDescriptor(_ comparisonOperator: DescType, _ operand1: UnsafeMutablePointer<AEDesc>!, _ operand2: UnsafeMutablePointer<AEDesc>!, _ disposeInputs: Bool, _ theDescriptor: UnsafeMutablePointer<AEDesc>!) -> OSErr
```

## Parameters

- `comparisonOperator`: The comparison operator for comparing the descriptors in the operand1 and operand2 parameters. The standard comparison operators are defined in doc://com.apple.documentation/documentation/applicationservices/apple_event_manager/comparison_operator_constants. The actual comparison of the two operands is performed by the object comparison function provided by the client application. The way a comparison operator is interpreted is up to each application. See doc://com.apple.documentation/documentation/coreservices/desctype.
- `operand1`: A pointer to an object specifier. See doc://com.apple.documentation/documentation/coreservices/aedesc.
- `operand2`: A pointer to a descriptor (which can be an object specifier or any other descriptor) whose value is compared to the value of operand1. See doc://com.apple.documentation/documentation/coreservices/aedesc.
- `disposeInputs`: A Boolean value. Pass TRUE if the function should automatically dispose of any descriptors you have provided in the operand1 and operand2 parameters to the function. Pass FALSE if your application will dispose of the descriptors itself. A value of FALSE may be more efficient for some applications because it allows them to reuse descriptors.
- `theDescriptor`: A pointer to a descriptor. On successful return, the comparison descriptor created by CreateCompDescriptor. Your application must dispose of this descriptor after it has finished using it. See doc://com.apple.documentation/documentation/coreservices/aedesc.

## Return Value

Return Value A result code. See Result Codes.

## See Also

### Creating Object Specifiers

- [CreateLogicalDescriptor(_:_:_:_:)](coreservices/1445212-createlogicaldescriptor.md)
- [CreateObjSpecifier(_:_:_:_:_:_:)](coreservices/1450244-createobjspecifier.md)
- [CreateOffsetDescriptor(_:_:)](coreservices/1444957-createoffsetdescriptor.md)
- [CreateRangeDescriptor(_:_:_:_:)](coreservices/1444087-createrangedescriptor.md)
