AcademySoftwareFoundation / AcademySoftwareFoundation/OpenImageIO

Using span and string_view instead of raw pointers

Open
#4,159 0 comments 0 reactions 0 assignees View on GitHub
core APIs roadmap
Dominant language
C++
Stars
2.4k
Forks
698
Avg merge
3d 4h
Merged PRs (30d)
47

Description

This task is to scrub the major APIs and eliminate as many places (as is practical, we know some may be harder than others) where we have API calls that take a pointer and size (or worse -- just a pointer and an assumption about the size), and instead use `span`/`cspan` for things that are like arrays, and `string_view` for things that are like strings.

For calls falling into this category, we'll have to decide on a case-by-case basis whether to (a) add a new variety of the call that takes a span, deprecating the old one, (b) replace the old one entirely.

Just as a way to seed you with ideas, and since this work can be parallelized by different people taking different classes, here is a list of some headers that probably contain functions that could use this cleanup:

- [ ] argparse.h
- [ ] deepdata.h
- [ ] imagebuf.h
- [ ] imagebufalgo.h
- [ ] imagecache.h
- [ ] imageio.h
- [ ] paramlist.h
- [ ] strutil.h
- [ ] texture.h

Contributor guide

Open the contributing guide

Research direction

Start by inventorying pointer-and-size APIs in the listed headers: argparse.h, deepdata.h, imagebuf.h, imagebufalgo.h, imagecache.h, imageio.h, paramlist.h, strutil.h, and texture.h. Review each call's API role and decide whether it should gain a span/string_view overload or replace the existing form; done means the practical candidates are updated with consistent compatibility decisions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.