WPILibC++
2027.0.0-alpha-3
Loading...
Searching...
No Matches
upcast.h
Go to the documentation of this file.
1
// Protocol Buffers - Google's data interchange format
2
// Copyright 2023 Google LLC. All rights reserved.
3
//
4
// Use of this source code is governed by a BSD-style
5
// license that can be found in the LICENSE file or at
6
// https://developers.google.com/open-source/licenses/bsd
7
8
#ifndef UPB_BASE_UPCAST_H_
9
#define UPB_BASE_UPCAST_H_
10
11
// Must be last.
12
#include "
upb/port/def.inc
"
13
14
// This macro provides a way to upcast message pointers in a way that is
15
// somewhat more bulletproof than blindly casting a pointer. Example:
16
//
17
// typedef struct {
18
// upb_Message UPB_PRIVATE(base);
19
// } pkg_FooMessage;
20
//
21
// void f(pkg_FooMessage* msg) {
22
// upb_Decode(UPB_UPCAST(msg), ...);
23
// }
24
25
#define UPB_UPCAST(x) (&(x)->base##_dont_copy_me__upb_internal_use_only)
26
27
#include "
upb/port/undef.inc
"
28
29
#endif
/* UPB_BASE_UPCAST_H_ */
def.inc
undef.inc
upb
base
upcast.h
Generated on Fri Oct 24 2025 05:38:27 for WPILibC++ by
1.12.0