GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
* Sign Up! *

Support
Customer Portal
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
__BUILTIN_OBJECT_SIZE(3) FreeBSD Library Functions Manual __BUILTIN_OBJECT_SIZE(3)

__builtin_object_sizereturn the size of the given object

size_t
__builtin_object_size(void *ptr, int type);

The () function is a clang(1) and gcc(1) built-in function that returns the size of the object referenced by ptr if known at compile time. If the ptr expression has any side effects, then they will not be evaluated.

If the size of the object is not known or the ptr expression has side effects, the __builtin_object_size() function returns:

for type 0 and 1.
for type 2 and 3.

If the size of the object is known, then the __builtin_object_size() function returns the maximum size of all the objects that the compiler knows can be pointed to by ptr when type & 2 == 0, and the minimum size when type & 2 != 0.

The __builtin_object_size() appeared in GCC 4.1.

This is a non-standard, compiler-specific extension.

Note that currently the object size calculation pass is only done at -O1 or above, meaning that this function always returns -1 when the optimizer is off.

There are some discussions about always doing the object size pass, but the issue is that without the optimization pass data sizes are not going to be correct.

For that reason code fortification (size-checked replacement functions) is currently disabled when optimization is off.

April 27, 2024 FreeBSD 15.1-RELEASE-p1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.