SpecialBuild
(1)
OfPreprocessor
(1)
Boekelheide
(1)
GeneratesM
(1)
Providenza
(1)
BuildNot
(1)
Preprocessor
(1)
Directives
(1)

How to get calculation eveluated at preprocessor

Asked By Angela Yan
12-Mar-10 01:14 AM
Hi everyone,

I got a following issue.




The output of the RESULT_STRING will be "Result is (3 * 10 * 10)" instead of

Anyone has any idea how to make the output to "Result is 300"??

Any help will be greatly appreciated.

ps. The value of M_NUM is generated during build time, so I cannot calculated
the value of ABC first and directly insert it into the string..

Thank you very much.

Cheers,
Angela

Angela Yan wrote:instead ofPreprocessor does not do math (well, it does, but

Igor Tandetnik replied to Angela Yan
12-Mar-10 08:26 AM
instead of


Preprocessor does not do math (well, it does, but only in #if =
directives). it is a text manipulation engine.
--=20
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not =
necessarily a good idea. It is hard to be sure where they are going to =
land, and it could be dangerous sitting under them as they fly overhead. =
-- RFC 1925

Unless you really do just need to add two zeros, the only solution to thisis

Tim Roberts replied to Angela Yan
14-Mar-10 09:56 PM
Unless you really do just need to add two zeros, the only solution to this
is to use sprintf.

CString sz;
sz.Format( "Result is %d", ABC );
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Thanks Igor and Tim..hmm..

Angela Yan replied to Tim Roberts
14-Mar-10 11:43 PM
Thanks Igor and Tim..

hmm.. Actually I need

And the resulted string is used in a RC file to show the "Special build
description":

VALUE "SpecialBuild", RESULT_STRING

So I guess.. does it mean there is no way to do it??

Thank you very much.

Angela
Angela Yan wrote:buildNot with the preprocessor, no.
Igor Tandetnik replied to Angela Yan
15-Mar-10 12:46 AM
build

Not with the preprocessor, no. I suppose the same build process that =
generated M_NUM could also be made to generate ABC.
--=20
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not =
necessarily a good idea. It is hard to be sure where they are going to =
land, and it could be dangerous sitting under them as they fly overhead. =
-- RFC 1925
hmm.. I do not have the source code of the build process which generatesM_NUM..
Angela Yan replied to Igor Tandetnik
15-Mar-10 02:24 AM
hmm.. I do not have the source code of the build process which generates
M_NUM..
hmm.. maybe I write my own process to do the calculation and add the string
during build time..
or.. maybe I can live with the fact that just show the M_NUM on the file and
let people to do the calculation themselves.. haa...

Thank you for both Igor and Tim..

Have a nice day~~

Angela



Not with the preprocessor, no. I suppose the same build process that
generated M_NUM could also be made to generate ABC.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily
a good idea. It is hard to be sure where they are going to land, and it
could be dangerous sitting under them as they fly overhead. -- RFC 1925
Post Question To EggHeadCafe