Comments (5)
Actually the spec does not say that they are write-only; just that they are uninitialized.
So I think that this program is correct.
from p4c.
So what does it mean to read from an uninitialized struct? Undefined behavior?
from p4c.
Yes, reading from an uninitialized variable or parameter produces an undefined value - but not an exception. So an out parameter is exactly like a local variable - initially uninitialized, but it's value at function termination is copied to the caller's corresponding argument.
from p4c.
Seems like a trap that programmers will inevitably step into. (I just did.)
from p4c.
This is modeled after the C# out: https://msdn.microsoft.com/en-us/library/t3c3bfhx.aspx
We do copy-out instead of call by reference. In C# the variable may be uninitialized - in our case it is always uninitialized.
from p4c.
Related Issues (20)
- Broken links on P4C docs page on P4Smith HOT 4
- Consider a CI/CD test run for DEBUG p4c build, instead of RELEASE HOT 4
- SourceInfo initializiation is inconsistent. HOT 2
- Compiler Bug: `Could not find type of <Type_Header> ...` on specialized generic struct type HOT 7
- How often we sync p4's pna.p4 with pna repo ? HOT 3
- Can't find `gc_mark.h` during build HOT 4
- Strange `IHasSourceInfo` interface
- Port Katran C application to P4. HOT 4
- bng.p4 is too large to be loaded into the kernel HOT 3
- Elevated memory usage in def-use HOT 2
- If the PSA frame NTK path set to true,the ARP packet will be sent as ipv4 . HOT 3
- Unexpected "Duplicates declaration" error when P4 program contains no duplicate declarations HOT 8
- `MoveInitializers` splits `start` state for parsers that do not need this
- Add mechanism for easily adding tests for command-line options HOT 1
- Error trying to compile 2024-sep-14 p4c source on Ubuntu Linux HOT 2
- `Compiler Bug` when `value_set` is used in a parser `select` expression
- Typedef annotations is not generated correctly HOT 4
- CI test test-p4c-mac / test-mac-os fails intermittently installing dependencies HOT 1
- Enable `const` identifiers in bit slice expressions, and anywhere else local compile-time known values are allowed HOT 2
- Expensive stream flushed HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p4c.