All of lore.kernel.org
 help / color / mirror / Atom feed
* Split and join. The preferred way.
@ 2018-12-06  9:11 Alexander Amelkin
  2018-12-07  7:51 ` vishwa
  2018-12-07 17:21 ` Ed Tanous
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Amelkin @ 2018-12-06  9:11 UTC (permalink / raw)
  To: openbmc


[-- Attachment #1.1: Type: text/plain, Size: 536 bytes --]

Hi all!

As we all know, it's a common programming task to split/tokenize strings and join tokens back together. Those trivial methods are however not implemented in STL for C++. There is a Boost way to do it, but as far as I understand, Boost is not endorsed in OpenBMC for understandable reasons of space-saving. Is there any openbmc-blessed method to split and join? Any commonly used library with the methods to perform the task? I hate code duplication and wouldn't like to reinvent the bicycle.

Thank you.

Alexander.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Split and join. The preferred way.
  2018-12-06  9:11 Split and join. The preferred way Alexander Amelkin
@ 2018-12-07  7:51 ` vishwa
  2018-12-07 16:53   ` James Feist
  2018-12-07 17:21 ` Ed Tanous
  1 sibling, 1 reply; 4+ messages in thread
From: vishwa @ 2018-12-07  7:51 UTC (permalink / raw)
  To: openbmc

When I had to tokenize before, I believe to have used std::stringstream 
/ std:strtok_r and no library that I am aware of.

I believe someone initiated this discussion a while ago and I am not 
sure where that went. Brad ?

!! Vishwa !!

On 12/06/2018 02:41 PM, Alexander Amelkin wrote:
> Hi all!
>
> As we all know, it's a common programming task to split/tokenize strings and join tokens back together. Those trivial methods are however not implemented in STL for C++. There is a Boost way to do it, but as far as I understand, Boost is not endorsed in OpenBMC for understandable reasons of space-saving. Is there any openbmc-blessed method to split and join? Any commonly used library with the methods to perform the task? I hate code duplication and wouldn't like to reinvent the bicycle.
>
> Thank you.
>
> Alexander.
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Split and join. The preferred way.
  2018-12-07  7:51 ` vishwa
@ 2018-12-07 16:53   ` James Feist
  0 siblings, 0 replies; 4+ messages in thread
From: James Feist @ 2018-12-07 16:53 UTC (permalink / raw)
  To: vishwa, openbmc

On 12/6/18 11:51 PM, vishwa wrote:
> When I had to tokenize before, I believe to have used std::stringstream 
> / std:strtok_r and no library that I am aware of.
> 
> I believe someone initiated this discussion a while ago and I am not 
> sure where that went. Brad ?
> 
> !! Vishwa !!
> 
> On 12/06/2018 02:41 PM, Alexander Amelkin wrote:
>> Hi all!
>>
>> As we all know, it's a common programming task to split/tokenize 
>> strings and join tokens back together. Those trivial methods are 
>> however not implemented in STL for C++. There is a Boost way to do it, 
>> but as far as I understand, Boost is not endorsed in OpenBMC for 

This has changed, boost is allowed if it is header only. We've use 
boost::split before.

https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#boost

Thanks,

James

>> understandable reasons of space-saving. Is there any openbmc-blessed 
>> method to split and join? Any commonly used library with the methods 
>> to perform the task? I hate code duplication and wouldn't like to 
>> reinvent the bicycle.
>>
>> Thank you.
>>
>> Alexander.
>>
>>
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Split and join. The preferred way.
  2018-12-06  9:11 Split and join. The preferred way Alexander Amelkin
  2018-12-07  7:51 ` vishwa
@ 2018-12-07 17:21 ` Ed Tanous
  1 sibling, 0 replies; 4+ messages in thread
From: Ed Tanous @ 2018-12-07 17:21 UTC (permalink / raw)
  To: Alexander Amelkin, openbmc

The current disposition on boost is documented here:

https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#boost

In short, so long as we're not compromising the project longevity by
increasing the binary sizes, and using well known, tested libraries,
boost functions are perfectly acceptable to use.  There are several
daemons that use a number of string operations from boost today, so
there are several examples that you could follow.  boost::asio is used
in the new webserver implementation, and there are asio extensions for
sdbusplus.

One thing that's recommended is to at a minimum set
BOOST_SYSTEM_NO_DEPRECATED in your compiler flags, to ensure you're not
linking against a static library for boost::system.

-Ed

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-07 17:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06  9:11 Split and join. The preferred way Alexander Amelkin
2018-12-07  7:51 ` vishwa
2018-12-07 16:53   ` James Feist
2018-12-07 17:21 ` Ed Tanous

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.