Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Question about Cyclone

I have read on Wikipedia that the Cyclone programming language is a safe dialect of the C programming language so consider the following C code.

int strlen(const char *s)
{
    int iter = 0;
    if (s == NULL) return 0;
    while (s[iter] != '\0') {
        iter++;
    }
    return iter;
}

This function assumes that the string being passed in is terminated by NUL ('\0'). But if we pass a string like this,

char buf[] = {'h','e','l','l','o','!'}

it would cause strlen to iterate through memory not necessarily associated with the string s. So there is another version of this code in Cyclone

int strlen(const char ? s)
{
    int iter, n = s.size;
    if (s == NULL) return 0;
    for (iter = 0; iter < n; iter++, s++) {
       if (*s == '\0') return iter;
    }
    return n;
}

Can I use Cyclone in Visual Studio or do I have to donwload a new compiler?

like image 442
dato datuashvili Avatar asked Aug 31 '10 20:08

dato datuashvili


People also ask

What are the main causes of cyclones?

What causes cyclone? Cyclones are centred on areas of low atmospheric pressure, usually over warm ocean waters near the equator. The warm moist air over the ocean rises from the surface in the upward direction, resulting in the formation of the low-pressure zone over the surface.

How are cyclone is formed?

A cyclone is formed when the warm, moist air rises upward over the ocean. As this air moves up, there is a formation of a low-pressure area below. Now the low-pressure area is filled with the high-pressure air from the surroundings. Again, the next batch of cool air gets warm and moist over the ocean moving upward.

What are the problems caused by cyclones?

Primary hazards include strong winds, heavy rains, and storms. The sea level rises abnormally near the coasts as a result of which the low-lying areas near the coastal regions get submerged, drowning humans, their livestock, and their inhabitations, destroying vegetation and soil fertility.

What are 3 impacts of cyclones?

A tropical cyclone brings very violent winds, torrential rain, high waves and, in some cases, very destructive storm surges and coastal flooding. The winds blow counterclockwise in the Northern Hemisphere and clockwise in the Southern Hemisphere.


1 Answers

You will need Cyclone. It is also the name of the compiler. The Cyclone compiler is available in source code here. The Cyclone compiler can, according to the documentation, only be compiled with GCC. Check this to compile the Cyclone compiler.

You can use it from Visual Studio if you provide custom rules for the *.cyc files. This way you can use the IDE as a better text editor. For syntax highlighting and style assign *.cyc to the C language extention list.

like image 141
jdehaan Avatar answered Oct 27 '22 23:10

jdehaan