mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 14:13:09 +00:00
81dc3f6f6e
Closes #54397. R=dacoharkes@google.com Cq-Include-Trybots: luci.dart.try:vm-aot-asan-linux-release-x64-try,vm-asan-linux-release-x64-try Change-Id: I4ae2cbc7f4eee1bfcd6d608dbc0d838da703c7e0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342460 Reviewed-by: Daco Harkes <dacoharkes@google.com> Reviewed-by: Derek Xu <derekx@google.com> Auto-Submit: Shikhar <shikharish05@gmail.com>
23 lines
560 B
Dart
23 lines
560 B
Dart
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:ffi';
|
|
|
|
import 'package:expect/expect.dart';
|
|
import 'package:ffi/ffi.dart';
|
|
|
|
void main() {
|
|
Pointer<Int32> p = calloc<Int32>(3);
|
|
final p1 = p;
|
|
p.value = 1;
|
|
(p + 1).value = 2;
|
|
(p + 2).value = 3;
|
|
Expect.equals(1, p.value);
|
|
p += 2;
|
|
Expect.equals(3, p.value);
|
|
p -= 1;
|
|
Expect.equals(2, p.value);
|
|
calloc.free(p1);
|
|
}
|