gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] Returning a string constant


From: Scott Robinson
Subject: [Gm2] Returning a string constant
Date: Sun, 26 Oct 2008 08:52:39 -0500

Hello all,

I was wondering if the Modula-2 code below is supposed to be illegal?

MODULE test1;

FROM InOut IMPORT WriteString, WriteLn;

TYPE
  testresult = ARRAY [0..9] OF CHAR;

PROCEDURE test() : testresult;
BEGIN
  (* Is this legal? *)
  RETURN "test";
END test;

BEGIN
  WriteString('Test results = "');
  WriteString(test());
  WriteString('"');
  WriteLn;
END test1.

The Modula-2 compiler is giving me this:

#gm2 -c -g test1.mod
test1.mod: In function ‘test’:
test1.mod:11: error: conversion to non-scalar type requested

Thanks,
Scott





reply via email to

[Prev in Thread] Current Thread [Next in Thread]