[Mono-dev] Mono.CSharp: Evaluating math expressions

Rob Wilkens robwilkens at gmail.com
Tue Jun 26 19:41:08 UTC 2012


I believe this page may answer your question:
http://msdn.microsoft.com/en-us/library/y31yhkeb(v=vs.100).aspx
Note that "*" in an unsafe context, can be taken to be a pointer
rather than a multiplication symbol, as it could be in standard C.
Inside of the parenthesis, you wouldn't be creating an object (or a
pointer to an object) so whatever parses your code can then safely
assume you are not creating a pointer object of type i.

I think this becomes obvious in Visual Studio where it reformats:
i*j;
to
i* j;
automatically.  Note it added a space because it presumed you were
creating an i type pointer named j.

-Rob

On Thu, Jun 21, 2012 at 1:35 PM, Fredo Morkel <fmorkel at yahoo.de> wrote:
> I'm trying out Mono.CSharp's evaluator. Why does this simple script work:
>
> int i=2,j=3;
> (i*j);
>
> whereas this gives an error:
>
> int i=2,j=3;
> i*j;
>
> saying "(1,2): error CS0246: The type or namespace name `i' could not be
> found. Are you missing a using directive or an assembly reference?"
>
> An expression like
> i+j;
> or
> i-j;
> work fine. So why does "i*j" NOT work?
>
> Regards,
> Fredo
>
>
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Mono-CSharp-Evaluating-math-expressions-tp4650120.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list


More information about the Mono-devel-list mailing list