-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set nil as the initial value of the struct reference type fields #192
Conversation
WalkthroughThe overarching change across multiple files is the introduction of default Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 8
Configuration used: CodeRabbit UI
Files selected for processing (11)
- gm/basicgm.v (1 hunks)
- ml/data.v (1 hunks)
- ml/kmeans.v (1 hunks)
- ml/knn.v (1 hunks)
- ml/linreg.v (1 hunks)
- ml/workspace.v (1 hunks)
- vcl/buffer.c.v (1 hunks)
- vcl/bytes.c.v (1 hunks)
- vcl/image.c.v (1 hunks)
- vcl/kernel.c.v (3 hunks)
- vcl/vector.c.v (1 hunks)
Files skipped from review due to trivial changes (1)
- ml/kmeans.v
Additional comments: 4
vcl/bytes.c.v (1)
- 5-5: The initialization of
buf
tonil
within an unsafe block is a significant change that ensures theBytes
struct starts with anil
reference forbuf
. This change is consistent with the pull request's goal to initialize reference type fields tonil
. However, it is important to ensure that all methods that interact withbuf
properly handle thenil
case to prevent null reference errors.ml/data.v (1)
- 25-30: The
x
field in theData
struct is now initialized tonil
within an unsafe block. This change is consistent with the pull request's goal to initialize reference type fields tonil
. However, it is important to ensure that all methods and functions that interact with theData
struct are updated to handle the possibility ofx
beingnil
. This includes checking fornil
before dereferencingx
and providing appropriate error handling or fallback logic.vcl/image.c.v (1)
- 22-27: The
Image
struct now initializes thedesc
field tonil
within an unsafe block. This change is consistent with the pull request's goal to initialize reference type fields tonil
to pass CI checks. However, it's important to ensure that any code that interacts with thedesc
field ofImage
instances properly handles thenil
value to avoid null reference errors. Additionally, since the change is made within an unsafe block, it bypasses the language's safety checks, which should be done with caution and only when necessary.vcl/buffer.c.v (1)
- 3-9: The change to initialize the
device
field tonil
using unsafe code is a significant alteration to theBuffer
struct. This change ensures that thedevice
field is explicitly set to a known state (nil
) rather than being uninitialized, which could lead to undefined behavior. However, it is important to ensure that all parts of the code that interact with theBuffer
struct are updated to handle thenil
value appropriately. This includes checking fornil
before dereferencing thedevice
field to avoid null pointer dereferences.
for green CI:
vlang/v#19944
Summary by CodeRabbit
Refactor
nil
for improved safety and consistency.Chores
Note: These changes should not directly affect end-user functionality but may enhance overall system stability and reliability.