Fix: Build error with bool boolean conversion. #126441

Closed
Aleksi Venäläinen wants to merge 1 commits from Aleksi-Venalainen/blender:main into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
First-time contributor

Similar error was ex. on pull request #118464

Similar error was ex. on pull request #118464
Aleksi Venäläinen added 1 commit 2024-08-17 22:06:52 +02:00
Similar error was  ex. on pull request #118464
Iliya Katushenock added the
Interest
Images & Movies
label 2024-08-17 22:09:51 +02:00
Iliya Katushenock added this to the Core project 2024-08-17 22:10:05 +02:00

I would be good to have a bit more info/context where current code fails? Preferably in the commit message itself.

I would be good to have a bit more info/context where current code fails? Preferably in the commit message itself.
Author
First-time contributor

I would be good to have a bit more info/context where current code fails? Preferably in the commit message itself.

Right here we go.

This boolean bool boolean conversions (implicit conversion from integral types to bool) can be made as error on example GCC 11.5.0 compiler or Clang >> notice referenced pull.

This pull makes the file which included in commit section (Files Changed - look it up) up to spec so it will compile ( i wrote build error in as subject.. so thats already existing answer to your question where ) with compilers which might not allow implicit conversions.. like the referenced pull file originally had as well.

Whats wrong?
Boolean as integer can be any number more than just 0 or 1. So it can lead to errors which why example GCC is more stricter these days. But we doing the opposite way? You will get the point still.

Just an example part..
Look at here in File Changes..

--jpeg_start_compress(cinfo, true);
++jpeg_start_compress(cinfo, TRUE);

This code is from library it references..

jpeg_start_compress JPP((j_compress_ptr cinfo,
				      boolean write_all_tables));

libjpeg waits there boolean but originally the code tries give just bool (false).

GCC and others can have in coming updates way more (like they have kept advancing to limit mistakes) stricter type-checking features and might issue warnings or errors depending on the compiler settings.

> I would be good to have a bit more info/context where current code fails? Preferably in the commit message itself. Right here we go. This boolean bool boolean conversions (**implicit conversion from integral types to bool**) can be made as error on example GCC 11.5.0 compiler or Clang >> notice referenced pull. This pull makes the file which included in commit section (Files Changed - look it up) up to spec so it will compile ( i wrote **build error** in as subject.. so thats already existing answer to your question `where` ) with compilers which might not allow implicit conversions.. like the referenced pull file originally had as well. Whats wrong? Boolean as integer can be any number more than just 0 or 1. So it can lead to errors which why example GCC is more stricter these days. But we doing the opposite way? You will get the point still. **Just an example part..** Look at here in File Changes.. ``` --jpeg_start_compress(cinfo, true); ++jpeg_start_compress(cinfo, TRUE); ``` This code is from library it references.. ``` jpeg_start_compress JPP((j_compress_ptr cinfo, boolean write_all_tables)); ``` libjpeg waits there boolean but originally the code tries give just bool (false). GCC and others can have in coming updates way more (like they have kept advancing to limit mistakes) stricter type-checking features and might issue warnings or errors depending on the compiler settings.

What I was requesting was specific information about compilers/system that do fail to build Blender currently without this 'fix'.

'Preventive' fix for potential future compiler changes and/or building with non-default, stricter options are also fine, but then I'd rather see another solution than re-introducing in our code-base hacks that were removed years ago when we fully supported C99 (not to mention that our codebase is now in C++).

Why not rather do some explicit conversion? boolean(true) if that works, or static_cast<boolean>(true)?

Point being, I'd rather not have things like TRUE re-introduced in our code for the sake of some random library that is still stuck in some hack around the missing bool type...

What I was requesting was specific information about compilers/system that do fail to build Blender currently without this 'fix'. 'Preventive' fix for potential future compiler changes and/or building with non-default, stricter options are also fine, but then I'd rather see another solution than re-introducing in our code-base hacks that were removed years ago when we fully supported C99 (not to mention that our codebase is now in C++). Why not rather do some explicit conversion? `boolean(true)` if that works, or `static_cast<boolean>(true)`? Point being, I'd rather not have things like `TRUE` re-introduced in our code for the sake of some random library that is still stuck in some hack around the missing `bool` type...
Author
First-time contributor

GCC11.5.0 and Clang mentioned. --

Forcing bool into boolean and hoping compiler supports it is then not a hack? Wrapping bool to turn into boolean is better way -- well it works too. -- removed nonsense baby rage and misunderstanding, my apologies i am easy to be such one--

Thank you.

GCC11.5.0 and Clang mentioned. -- Forcing bool into boolean **and hoping compiler supports it** is then not a hack? Wrapping bool to turn into boolean is better way -- well it works too. -- removed nonsense baby rage and misunderstanding, my apologies i am easy to be such one-- Thank you.
@Aleksi-Venalainen I am asking you to take a look at our code of conduct. https://developer.blender.org/docs/handbook/communication/code_of_conduct/

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#126441
No description provided.