Skip to content

Commit 7802d44

Browse files
committed
tweak a few comments
1 parent ddb4f9a commit 7802d44

File tree

2 files changed

+8
-26
lines changed

2 files changed

+8
-26
lines changed

src/clib/dynamic_api.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ constexpr param_list string_param_l_ = INIT_PAR_LIST(string_param_entries_);
9999

100100
/// retrieves a pointer to the field of my_chemistry that's named ``name``.
101101
///
102-
/// This returns a nullptr pointer if: my_chemistry is nullptr, the field doesn't
103-
/// exist, or the field doesn't have the specified type
102+
/// This returns a nullptr pointer if:
103+
/// - my_chemistry is nullptr
104+
/// - the field doesn't exist
105+
/// - the field doesn't have the specified type
104106
static void* get_field_ptr_(chemistry_data* my_chemistry, const char* name,
105107
const param_list my_param_l)
106108
{
@@ -152,8 +154,9 @@ char** local_chemistry_data_access_string(chemistry_data* my_chemistry,
152154
// These are primarily needed for testing purposes and can be used for
153155
// serialization.
154156

155-
// returns the name of the ``i``th parameter of the specified type. This returns
156-
// nullptr when there are ``i`` or fewer parameters of the specified type
157+
/// returns the name of the ``i``th parameter of the specified type. This
158+
/// returns nullptr when there are ``i`` or fewer parameters of the specified
159+
/// type
157160
static const char* param_name_(std::size_t i, const param_list my_param_list)
158161
{ return (i < my_param_list.len) ? my_param_list.entries[i].name : nullptr; }
159162

@@ -180,4 +183,4 @@ unsigned int grackle_num_params(const char* type_name){
180183
return 0;
181184
}
182185

183-
} // extern "C"
186+
} // extern "C"

src/clib/rate_utils.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,6 @@
1818
#include "LUT.hpp" // CollisionalRxnLUT
1919
#include "opaque_storage.hpp" // gr_opaque_storage
2020

21-
// In comparison to the dynamic API for accessing elements of chemistry_data,
22-
// we have explicitly opted NOT to make use of offsetof to access arbitrary
23-
// values within a struct.
24-
// -> while `offsetof` may lead to somewhat simpler code, the validity of using
25-
// it with pointer-arithmetic to access members of structs is murky at best.
26-
// - Things become murky when you consider that the C standard models an
27-
// abstract machine and doesn't place the strongest (or clearest)
28-
// constraints on a compiler when you start arbitrarily messing with
29-
// memory
30-
// - C's object model (and maybe also pointer provenance) is relevant
31-
// -> An extended discussion can be found in this stackoverflow answer and in
32-
// the comments about the answer (https://stackoverflow.com/a/69936600).
33-
// - the most compelling point is that it would be useless for the standard
34-
// to define the `offsetof` if these semantics didn't work
35-
// -> In any case, I'm much more skeptical that valid C++ code can make use of
36-
// offsetof in this fashion (the object model is stricter and C++ provides a
37-
// other machinery to accomplish similar things). Since we want to support
38-
// compilation with a C++ compiler, this is the most important point
39-
// offsetof in this fashion
40-
//
41-
4221
// we have reserved the right to change this value at any time
4322
enum { UNDEFINED_RATE_ID_ = 0 };
4423

0 commit comments

Comments
 (0)