Is this some secret code????

Jul 15, 2008 at 10:16pm

I got this code from a book. Can you tell me what OUL means. Is it secret code for something???? Its not defined anywhere. I was wondering if its something from standard library... Thanks.

#include"MCStatistics.h"

using namespace std;

StatisticsMean::StatisticsMean:
RunningSum(0.0), PathsDone(OUL)
{}
Jul 16, 2008 at 12:39am
Find the contents of MCStatistics.h, it was probably defined in there someplace.
Jul 16, 2008 at 1:47am
Its not defined there. So I was curious if it was some weird function. Its probably a miss print.
Jul 16, 2008 at 2:03am
Google search turns up nothing. Does it compile? Does the text say anything about it? (maybe in previous sections where they use the same example)
Jul 16, 2008 at 2:48am
The header file MCStatistics.h is the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef STATISTICS_H
#define STATISTICS_H

#include <vector>

class StatisticsMC{
public:
   StatisticsMC(){}
   virtual void DumpOneResult(double result)=0;
   virtual std::vector<std::vector<double> > GetResultsSoFar() const =0;
   virtual StatisticsMC* clone() const=0;
   virtual ~StatisticsMC(){}
private:
};
class StatisticsMean: public StatisticsMC{
public:
   StatisticsMean();
   virtual void DumpOneResult(double result);
   virtual std::vector<std::vector<double> > GetResultsSoFar() const;
   virtual StatisticsMC* clone() const;
private:
   double RunningSum;
   unsigned long PathsDone;
};
#endif  


StatisticsMean::StatisticsMean: RunningSum(0.0), PathsDone(OUL)
This is the constructor for the StatisticsMean class. It sets as RunningSum the value 0.0 and as PathsDone probably an unsigned long 0 (0UL). At least that is what I understand from the preview of the book I had because it uses the PathsDone value just as a counter. So you can just use there PathsDone(0).
It is from book "C++ Design Patterns and Derivatives Pricing" By Mark S. Joshi. I found it as a preview for Google books.

Hope that helps
Last edited on Jul 16, 2008 at 3:00am
Jul 16, 2008 at 3:01am
Ok, I found something.
This is from the help of VC++ Express
C++ Integer Constants
To specify an unsigned type, use either the u or U suffix. To specify a long type, use either the l or L suffix. For example:

unsigned uVal = 328u; // Unsigned value
long lVal = 0x7FFFFFL; // Long value specified as hex constant
unsigned long ulVal = 0776745ul; // Unsigned long value


So, the 0UL (Zero-U-L) means the unsigned long with value 0.

Here is the link for the same article in msdn:
http://msdn.microsoft.com/en-us/library/00a1awxf(VS.80).aspx
Last edited on Jul 16, 2008 at 3:03am
Jul 16, 2008 at 3:59am
Ah that makes since, i was searching for O(letter)UL not 0(number)UL. Good job.
Jul 16, 2008 at 9:26pm
Wow. Thanks a lot for the help!! Yea, I was searching for O letter too on google, but didn't find much. Anyways. You guys rule!!!
Topic archived. No new replies allowed.