[PATCH] D67867: [libc] Add few docs and implementation of strcpy and strcat.

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 07:00:15 PDT 2019


jyknight added a comment.

In D67867#1683099 <https://reviews.llvm.org/D67867#1683099>, @sivachandra wrote:

> I did consider such a layout. However, the same kind of distinction can be achieved by two things:
>
> 1. Next to the implementation and/or target listing for a function, call out the standard/extension that prescribes it.
> 2. When composing the target for libc.a for a platform, group the functions per standards/extensions they come from.
>
>   Another point which made me not pick this layout: I agree that as a catalog, the structure you are suggesting could be more meaningful. But as a developer, my mental model is much simpler if all the functions from a header file are grouped in one place, irrespective of the standard they come from.


Which standard the function is from could be useful to think about while writing/reading the code -- it might be good to, in general, only use functions from the same or "lower" standard versions when implementing functions in a "higher" standard. Although...if the namespacing mechanism described here is kept, and calls are all made only to other llvm_libc-namespace functions, it's less problematic to use nonstandard functions. Doing so then won't pollute the linker namespace, unlike if you're calling C toplevel functions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67867/new/

https://reviews.llvm.org/D67867





More information about the llvm-commits mailing list