2288
2288
{#code|test_aligned_struct_fields.zig#}
2289
2289
2290
2290
<p>
2291
- Equating packed structs results in a comparison of the backing integer,
2291
+ Equating packed structs results in a comparison of the backing integer,
2292
2292
and only works for the `==` and `!=` operators.
2293
2293
</p>
2294
2294
{#code|test_packed_struct_equality.zig#}
@@ -4086,7 +4086,7 @@ fn performFn(start_value: i32) i32 {
4086
4086
special-case syntax.
4087
4087
</p>
4088
4088
<p>
4089
- Here is an example of a generic {#syntax#}List{#endsyntax#} data structure.
4089
+ Here is an example of a generic {#syntax#}List{#endsyntax#} data structure.
4090
4090
</p>
4091
4091
{#code|generic_data_structure.zig#}
4092
4092
@@ -4291,10 +4291,10 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {
4291
4291
<pre>{#syntax#}@addrSpaceCast(ptr: anytype) anytype{#endsyntax#}</pre>
4292
4292
<p>
4293
4293
Converts a pointer from one address space to another. The new address space is inferred
4294
- based on the result type. Depending on the current target and address spaces, this cast
4295
- may be a no-op, a complex operation, or illegal. If the cast is legal, then the resulting
4296
- pointer points to the same memory location as the pointer operand. It is always valid to
4297
- cast a pointer between the same address spaces.
4294
+ based on the result type. Depending on the current target and address spaces, this cast
4295
+ may be a no-op, a complex operation, or illegal. If the cast is legal, then the resulting
4296
+ pointer points to the same memory location as the pointer operand. It is always valid to
4297
+ cast a pointer between the same address spaces.
4298
4298
</p>
4299
4299
{#header_close#}
4300
4300
{#header_open|@addWithOverflow#}
@@ -4307,7 +4307,7 @@ pub fn print(self: *Writer, arg0: []const u8, arg1: i32) !void {
4307
4307
<pre>{#syntax#}@alignCast(ptr: anytype) anytype{#endsyntax#}</pre>
4308
4308
<p>
4309
4309
{#syntax#}ptr{#endsyntax#} can be {#syntax#}*T{#endsyntax#}, {#syntax#}?*T{#endsyntax#}, or {#syntax#}[]T{#endsyntax#}.
4310
- Changes the alignment of a pointer. The alignment to use is inferred based on the result type.
4310
+ Changes the alignment of a pointer. The alignment to use is inferred based on the result type.
4311
4311
</p>
4312
4312
<p>A {#link|pointer alignment safety check|Incorrect Pointer Alignment#} is added
4313
4313
to the generated code to make sure the pointer is aligned as promised.</p>
@@ -4384,7 +4384,7 @@ comptime {
4384
4384
<pre>{#syntax#}@bitCast(value: anytype) anytype{#endsyntax#}</pre>
4385
4385
<p>
4386
4386
Converts a value of one type to another type. The return type is the
4387
- inferred result type.
4387
+ inferred result type.
4388
4388
</p>
4389
4389
<p>
4390
4390
Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}.
@@ -4741,42 +4741,6 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
4741
4741
{#see_also|@cVaArg|@cVaCopy|@cVaEnd#}
4742
4742
{#header_close#}
4743
4743
4744
- {#header_open|@deprecated#}
4745
- <pre>{#syntax#}@deprecated(value: anytype) @TypeOf(value){#endsyntax#}</pre>
4746
- <pre>{#syntax#}@deprecated() void{#endsyntax#}</pre>
4747
- <p>
4748
- Marks a given code path as scheduled for removal. Evaluates to the same
4749
- value passed in as argument, or the {#syntax#}void{#endsyntax#} value
4750
- when given none.
4751
- </p>
4752
- <p>
4753
- When a public declaration has been moved to a new location, the old
4754
- location can be marked {#syntax#}@deprecated{#endsyntax#}:
4755
- </p>
4756
- {#syntax_block|zig|root.zig#}
4757
- pub const fooToBar = @deprecated(bar.fromFoo); // moved
4758
- {#end_syntax_block#}
4759
- <p>
4760
- By default deprecated code paths are disallowed in a module defined by
4761
- the root package but allowed in modules defined by the rest of the
4762
- dependency tree. This behavior can be overridden by passing
4763
- <code>-fallow-deprecated</code> or <code>-fno-allow-deprecated</code> to
4764
- <code>zig build</code>.
4765
- </p>
4766
- <p>
4767
- The purpose of {#syntax#}@deprecated{#endsyntax#} is to provide at least
4768
- one version (a "grace period") of a package that supports both old and new APIs
4769
- simultaneously, while providing tooling for programmers to discover what needs
4770
- to be upgraded to migrate to the new API. Such a grace period has the key property
4771
- that it allows a project's dependency tree to be upgraded <em>one package at a time</em>.
4772
- </p>
4773
- <p>
4774
- Using {#syntax#}@deprecated{#endsyntax#} without an argument can be
4775
- useful inside of conditionally compiled blocks:
4776
- </p>
4777
- {#code|test_deprecated_builtin.zig#}
4778
- {#header_close#}
4779
-
4780
4744
{#header_open|@divExact#}
4781
4745
<pre>{#syntax#}@divExact(numerator: T, denominator: T) T{#endsyntax#}</pre>
4782
4746
<p>
@@ -4891,8 +4855,8 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
4891
4855
<pre>{#syntax#}@errorCast(value: anytype) anytype{#endsyntax#}</pre>
4892
4856
<p>
4893
4857
Converts an error set or error union value from one error set to another error set. The return type is the
4894
- inferred result type. Attempting to convert an error which is not in the destination error
4895
- set results in safety-checked {#link|Illegal Behavior#}.
4858
+ inferred result type. Attempting to convert an error which is not in the destination error
4859
+ set results in safety-checked {#link|Illegal Behavior#}.
4896
4860
</p>
4897
4861
{#header_close#}
4898
4862
@@ -4971,7 +4935,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
4971
4935
<pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>
4972
4936
<p>
4973
4937
Converts an integer to the closest floating point representation. The return type is the inferred result type.
4974
- To convert the other way, use {#link|@intFromFloat#}. This operation is legal
4938
+ To convert the other way, use {#link|@intFromFloat#}. This operation is legal
4975
4939
for all values of all integer types.
4976
4940
</p>
4977
4941
{#header_close#}
@@ -5063,7 +5027,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
5063
5027
<pre>{#syntax#}@intCast(int: anytype) anytype{#endsyntax#}</pre>
5064
5028
<p>
5065
5029
Converts an integer to another integer while keeping the same numerical value.
5066
- The return type is the inferred result type.
5030
+ The return type is the inferred result type.
5067
5031
Attempting to convert a number which is out of range of the destination type results in
5068
5032
safety-checked {#link|Illegal Behavior#}.
5069
5033
</p>
@@ -5316,7 +5280,7 @@ pub const fooToBar = @deprecated(bar.fromFoo); // moved
5316
5280
<pre>{#syntax#}@ptrFromInt(address: usize) anytype{#endsyntax#}</pre>
5317
5281
<p>
5318
5282
Converts an integer to a {#link|pointer|Pointers#}. The return type is the inferred result type.
5319
- To convert the other way, use {#link|@intFromPtr#}. Casting an address of 0 to a destination type
5283
+ To convert the other way, use {#link|@intFromPtr#}. Casting an address of 0 to a destination type
5320
5284
which in not {#link|optional|Optional Pointers#} and does not have the {#syntax#}allowzero{#endsyntax#} attribute will result in a
5321
5285
{#link|Pointer Cast Invalid Null#} panic when runtime safety checks are enabled.
5322
5286
</p>
0 commit comments