The answer to this question lies in the dual nature of laws - on the one hand, they exist so that people will know how to behave, and on the other hand, they exist to protect people from arbitrary accusation and persecution. For example, if there is a law that says that everyone must stop at red lights, drivers know that if they do not do this, they will likely receive a consequence, in the form of a ticket. Conversely, if a driver is given a ticket for not stopping at a red light when, in fact, the light had just turned yellow, that driver can defend himself by showing, through witnesses or other evidence, that he did not break the law that says he is to stop at red lights, because the light was not red when he passed through. Laws delineate the boundaries of behavior so that everyone is on the same page.
In Oceania, as stated in Chapter 1 of 1984, "nothing was illegal, since there were no longer any laws," but if Winston was caught writing in his diary, "it was reasonably certain that it would be punished by death, or at least by twenty-five years in a forced-labor camp." It might be argued that the law against writing in a diary actually exists in a sense, because everyone knows that it is forbidden to write in a diary, but since the law is unwritten - technically, there are no laws - a person would have no recourse if he feels he is being punished unfairly. The government has unlimited and ultimate control in Oceania, which is why it is such a terrifying and repressive place. A person can be vaporized just because the government believes that he has violated one of its unwritten laws, or really, for any reason whatsoever. In the absence of a clearly delineated code of conduct to which both the accuser and accused must adhere, there is nothing that the victimized party or anyone else can do about it.